随笔分类 - ACM---《挑战程序设计》
摘要:Description The SUM problem can be formulated as follows: given four lists A, B, C, D of integer values, compute how many quadruplet (a, b, c, d ) ∈ A
阅读全文
摘要:Description Simon is doing a physics experiment with N identical balls with the same radius of R centimeters. Before the experiment, all N balls are f
阅读全文
摘要:Description Jessica's a very lovely girl wooed by lots of boys. Recently she has a problem. The final exam is coming, yet she has spent little time on
阅读全文
摘要:DescriptionThe cows have a line of 20 water bowls from which they drink. The bowls can be either right-side-up (properly oriented to serve refreshing ...
阅读全文
摘要:DescriptionFermat's theorem states that for any prime number p and for any integer a > 1, ap = a (mod p). That is, if we raise a to the pth power and ...
阅读全文
摘要:题目大意:给你N台电脑,从1-N。一个数字,表示两台计算机的最大通信距离,超过这个距离就无法进行通信。然后分别告诉这些电脑的坐标,接下来有两种操作,第一种O表示这点电脑修好,第二种S,表示测试这两台电脑能不能进行正常的通信解题思路:并查集的简单应用,对每次修好的电脑对其它已经修好的电脑遍历,如果距离...
阅读全文
摘要:奶牛们建了一家酸奶厂,在N周内每周需要出货Y_i单位酸奶,第i周成本为C_i,储存费为每周S。求总体最低成本。贪心策略是维持每周的最低单位成本,每周可能用上周剩下的,也可能生产新的。于是该周单位成本可能为上一周的单位成本加上储存费,也可能为该周的单位成本。 1 #pragma comment(lin...
阅读全文
摘要:DescriptionThere are N cities in a country, and there is one and only one simple path between each pair of cities. A merchant has chosen some paths an...
阅读全文
摘要:DescriptionThe cows have run out of hay, a horrible event that must be remedied immediately. Bessie intends to visit the other farms to survey their h...
阅读全文
摘要:DescriptionBessie has been hired to build a cheap internet network among Farmer John's N (2 3 #include 4 #include 5 #include 6 #include 7 #include 8 ...
阅读全文
摘要:DescriptionFarmer John's cows refused to run in his marathon since he chose a path much too long for their leisurely lifestyle. He therefore wants to ...
阅读全文
摘要:DescriptionFarmer John's farm has N barns, and there are some cows that live in each barn. The cows like to drop around, so John wants to build some r...
阅读全文
摘要:DescriptionRatish is a young man who always dreams of being a hero. One day his friend Luffy was caught by Pirate Arlong. Ratish set off at once to Ar...
阅读全文
摘要:DescriptionKatu Puzzle is presented as a directed graph G(V, E) with each edge e(a, b) labeled by a boolean operator op (one of AND, OR, XOR) and an i...
阅读全文
摘要:DescriptionA Compiler Mystery: We are given a C-language style for loop of type for (variable = A; variable != B; variable += C) statement;I.e., a lo...
阅读全文
摘要:DescriptionA network of m roads connects N cities (numbered from 1 to N). There may be more than one road connecting one city with another. Some of th...
阅读全文
摘要:DescriptionBessie is such a hard-working cow. In fact, she is so focused on maximizing her productivity that she decides to schedule her next N (1 ≤ N...
阅读全文
摘要:DescriptionIt is a little known fact that cows love apples. Farmer John has two apple trees (which are conveniently numbered 1 and 2) in his field, ea...
阅读全文
摘要:DescriptionFarmer John commanded his cows to search for different sets of numbers that sum to a given number. The cows use only numbers that are an in...
阅读全文
摘要:DescriptionThe New Year garland consists of N lamps attached to a common wire that hangs down on the ends to which outermost lamps are affixed. The wi...
阅读全文