題目描述Now,we know that Yuanfang is the best student in the class. Every time when the teacher comes up with a hard problem and it seems no student can solve it, He always says: "Yuanfang , what do you think?". Today, They had another math class,(
題意:一塊玉米地,有的位置不能種草,種草的小方格不能有臨邊. 問有多少種方案.思路:狀壓DP.dp[ i ][ j ] 表示從上到下處理到第 i 行時, 該行狀態為 j 的方案數.下一行某狀態的方案數就是上一行所有合理狀態的方案數之和.注意初始化和最後一行的處理.#include <cstdio>#include <cstring>using namespace std;const int MAXN = 14;const int MOD = 1e8;typedef
The SuspectsTime Limit: 1000MS Memory Limit: 20000KTotal Submissions: 17149 Accepted: 8272DescriptionSevere acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To
Ubiquitous ReligionsTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 19292 Accepted: 9472DescriptionThere are so many different religions in the world today that it is difficult to keep track of them all. You are interested in finding out
連結:http://poj.org/problem?id=2253http://acm.hust.edu.cn/vjudge/contest/view.action?cid=22010#problem/DFroggerTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 21206 Accepted: 6903DescriptionFreddy Frog is sitting on a stone in the middle of
連結:http://poj.org/problem?id=1125http://acm.hust.edu.cn/vjudge/contest/view.action?cid=22010#problem/EStockbroker GrapevineTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 23440 Accepted: 12854DescriptionStockbrokers are known to overreact
題意:電梯, 在第 i 層只能向上或向下走 ki 步, 問從 A 層到 B 層最少走多少步.思路:有向圖求最短路. 用Dijkstra, 都是正權值.注意:vector要清空 ! ! ! [ 淚目]#include <cstdio>#include <vector>#include <cstring>using namespace std;const int MAXN = 205;const int INF =
連結:http://poj.org/problem?id=1050http://acm.hust.edu.cn/vjudge/contest/view.action?cid=28508#problem/BTo the MaxTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 36968 Accepted: 19480DescriptionGiven a two-dimensional array of positive and
不多說了啊、、典型的最小產生樹啊、、、Agri-NetTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 33507 Accepted: 13416DescriptionFarmer John has been elected mayor of his town! One of his campaign promises was to bring internet connectivity to all farms in the