acm

AOAPC I: Volume 0

Written by  on October 22, 2014

<<算法竞赛入门经典>> UVaoj 第一卷习题: 10055-Hashmat the Brave Warrior 注意读懂题意, “or vice versa”(反之亦然), 所以注意加一个fabs(a-b), UVaoj第一题就被卡了几次, 简直羞耻Play.

[Read more...]

POJ2085

Written by  on October 12, 2014

POJ2085 Inversion Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 4004 Accepted: 1790 Description The inversion number of an integer sequence a1, a2, . . . , an is the number of pairs (ai, aj) that satisfy i < j and ai > aj . Given n and the inversion number m, your task is to find the smallest permutation of the set { 1, 2, . . . , n }, whose inversion number is exactly m.

[Read more...]

POJ2084

Written by  on October 10, 2014

POJ2084 Game of Connections Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 7901 Accepted: 3973 Description This is a small but ancient game. You are supposed to write down the numbers 1, 2, 3, . . . , 2n – 1, 2n consecutively in clockwise order on the ground to form a circle, and then, to draw some straight line segments to connect them into number pairs. Every number must be connected to exactly one another.

[Read more...]

POJ2140

Written by  on September 17, 2014

最近改变刷题思路,开始跟Stanford的CS97SI来刷POJ,这样的话感觉比单纯地按照题目分类来刷更有效率一点 POJ2140 Herd Sums

[Read more...]

POJ1125

Written by  on August 29, 2014

POJ1125 Stockbroker Grapevine Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 31827 Accepted: 17443 Description Stockbrokers are known to overreact to rumours. You have been contracted to develop a method of spreading disinformation amongst the stockbrokers to give your employer the tactical edge in the stock market. For maximum effect, you have to spread the rumours in the fastest possible way.

[Read more...]

POJ1062

Written by  on August 22, 2014

POJ1062 昂贵的聘礼 Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 41914 Accepted: 12245 Description 年轻的探险家来到了一个印第安部落里。在那里他和酋长的女儿相爱了,于是便向酋长去求亲。酋长要他用10000个金币作为聘礼才答应把女儿嫁给他。探险家拿不出这么多金币,便请求酋长降低要求。酋长说:”嗯,如果你能够替我弄到大祭司的皮袄,我可以只要8000金币。如果你能够弄来他的水晶球,那么只要5000金币就行了。”探险家就跑到大祭司那里,向他要求皮袄或水晶球,大祭司要他用金币来换,或者替他弄来其他的东西,他可以降低价格。探险家于是又跑到其他地方,其他人也提出了类似的要求,或者直接用金币换,或者找到其他东西就可以降低价格。不过探险家没必要用多样东西去换一样东西,因为不会得到更低的价格。探险家现在很需要你的帮忙,让他用最少的金币娶到自己的心上人。另外他要告诉你的是,在这个部落里,等级观念十分森严。地位差距超过一定限制的两个人之间不会进行任何形式的直接接触,包括交易。他是一个外来人,所以可以不受这些限制。但是如果他和某个地位较低的人进行了交易,地位较高的的人不会再和他交易,他们认为这样等于是间接接触,反过来也一样。因此你需要在考虑所有的情况以后给他提供一个最好的方案。

[Read more...]

POJ3259

Written by  on August 19, 2014

POJ3259 Wormholes Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 37982 Accepted: 13985 Description While exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is very peculiar because it is a one-way path that delivers you to its destination at a time that is BEFORE you entered the wormhole! Each of FJ’s farms comprises N (1 ≤ N ≤ 500) fields conveniently numbered 1..N, M (1 ≤ M ≤ 2500) paths, and W (1 ≤ W ≤ 200) wormholes.

[Read more...]

POJ1860

Written by  on August 18, 2014

POJ1860 Currency Exchange Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 23824 Accepted: 8620 Description Several currency exchange points are working in our city. Let us suppose that each point specializes in two particular currencies and performs exchange operations only with these currencies. There can be several points specializing in the same pair of currencies. Each point has its own exchange rates, exchange rate of A to B is the quantity of B you get for 1A. Also each exchange point has some commission, the sum you have to pay for your exchange operation. Commission is always collected in source currency.

[Read more...]

POJ2499

Written by  on August 16, 2014

POJ2499 Binary Tree Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 6424 Accepted: 2954 Description Background Binary trees are a common data structure in computer science. In this problem we will look at an infinite binary tree where the nodes contain a pair of integers. The tree is constructed like this:

[Read more...]

Codeforces #459 B

Written by  on August 16, 2014

Codeforces #459 B B. Pashmak and Flowers time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output

[Read more...]