poj_icpc/acm
文章平均质量分 76
threegirl
这个作者很懒,什么都没留下…
展开
-
(BFS)3414 Pots
/* 3414 Pots */ #include #include #include #include using namespace std; const int MAX = 101; string FILL1 = "FILL(1)\n"; string FILL2 = "FILL(2)\n"; string POUR1 = "POUR(1,2)\n"; string POUR2原创 2012-10-29 15:38:17 · 159 阅读 · 0 评论 -
(BFS)2251 Dungeon Master
/* 2251 Dungeon Master */ #include #include #include using namespace std; const int MAX = 31; char maze[MAX][MAX][MAX]; int visited[MAX][MAX][MAX]; int l, r, c; int t; struct Node{ int x;原创 2012-10-30 18:14:31 · 189 阅读 · 0 评论 -
3278Catch That Cow
/* 3278 Catch That Cow */ #include #include using namespace std; const int MAX = 200004; bool ans[MAX]; int n,k; struct Node{ int num; int index; Node(int _num, int _index):num(_num原创 2012-10-28 21:29:02 · 178 阅读 · 0 评论 -
3126 Prime Path
使用visited[]数组来避免重复操作。 如何判断一个数为质数的函数。 int upper = i / 2; int flag = 0; for( j = 3; j { upper = i / j; if( i % j == 0 ) { flag = 1; break; } } if( flag == 0 ) number[i] =原创 2012-10-29 00:43:26 · 202 阅读 · 0 评论 -
(POJ)2140 Herd Sums
#include using namespace std; int main() { int n; cin >> n; int ans = 1; int c = 1; for( n -= c; n > 0; n -= c ) { c++; if( n % c == 0 ) ans++; } cout << ans << endl; } example: n =原创 2013-04-04 15:14:39 · 362 阅读 · 0 评论