摘要:
DescriptionYou have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language. Fortunately, you have a dictionary to help you understand them.InputInput consists of up to 100,000 dictionary entries, followed by a blank line, followed by a message
閱讀全文
摘要:
DescributionStandard web browsers contain features to move backward and forward among the pages recently visited. One way to implement these features is to use two stacks to keep track of the pages that can be reached by moving backward and forward. In this problem, you are asked to implement this.
閱讀全文
摘要:
DescriptionYou are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one minute to move one unit north, south, east, west, up or down. You cannot move diagonally and the maze is surrounded by solid
閱讀全文
摘要:
DescriptionThere is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent tiles. But he can't move on red tiles, he can move only on black tiles. Write a program to count the nu
閱讀全文
摘要:
DescriptionDue to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle of N x M (1 <= N <= 100; 1 <= M <= 100) squares. Each square contains either water ('W') or dry land ('.'). Farmer John would like to figure
閱讀全文
摘要:
DescriptionDue to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle of N x M (1 <= N <= 100; 1 <= M <= 100) squares. Each square contains either water ('W') or dry land ('.'). Farmer John would like to figure
閱讀全文
摘要:
DescriptionYou are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one minute to move one unit north, south, east, west, up or down. You cannot move diagonally and the maze is surrounded by solid
閱讀全文
摘要:
DescriptionBessie has gone to the mall's jewelry store and spies a charm bracelet. Of course, she'd like to fill it with the best charms possible from the N (1 ≤ N ≤ 3,402) available charms. Each charm i in the supplied list has a weightWi (1 ≤ Wi ≤ 400), a 'desirability' factor Di (
閱讀全文
摘要:
描述 打敗萬惡的ghost以后,將軍準備回寢室告訴大伙兒這個消息,沒想到杯具又發生了… 你知道有種鬼叫路鬼嗎?讓人莫名其妙的迷路,將軍就被這種鬼上身了。將軍本來要上樓梯的,但是因為鬼上身,他要不就上一層樓,要不就下一層樓,這個是隨機的,他不能控制自己啦! 假設將軍住在第M樓,因為體力原因,將軍只能上或者下N次樓,剛開始將軍在K樓,假設東6宿舍共有100層。現在問當體力消耗完的時候,將軍剛好回到寢室那一層有多少種可能。 例如:將軍住在5樓,將軍的能上/下5次樓,現在在1樓, 那么將軍將回不到寢室啦,為什么?我也不知道。 輸入有多組測試數據,每組測試數據共一行,為M,N,K(0 < N &l
閱讀全文
摘要:
題目:http://poj.org/problem?id=1861說下題意,給出節點個數m和邊數n,下面n行給出邊(x,y)以及權值w。輸出第一行為最小生成樹中的最大邊權值,第二行為一個可行生成樹方案的邊數k,下面k行為可行生成樹的k條邊。題目是Special Judge,意思就是不具有唯一解,可能有多解,樣例輸出為以下結果也可算對。131 32 42 3一樣按照Kruskal解題即可,結果雖然不唯一,但是最小生成樹一定是可行解之一。將邊加入生成樹時記錄最大權值和邊信息然后輸出即可。View Code #include "iostream"#include "al
閱讀全文
摘要:
1 <html> 2 <head> 3 <style type="text/css"> 4 p.ex1 5 { 6 font:italic arial,sans-serif; 7 } 8 9 p.ex210 {11 font:italic bold 12px/30px arial,sans-serif;12 }13 </style>14 </head>15 16 <body>17 <p class="ex1">18 This is a paragraph. This is
閱讀全文
摘要:
DescriptionFarmer John has been elected mayor of his town! One of his campaign promises was to bring internet connectivity to all farms in the area. He needs your help, of course.Farmer John ordered a high speed connection for his farm and is going to share his connectivity with the other farmers. T
閱讀全文