2011年8月9日

Nightmare hdu 1072

摘要: #include <stdio.h>#include <string.h>#include <stdlib.h>#include <queue>#include <algorithm>using namespace std;int T, N, M, a, b, c, d, f1;int map[10][10];int xx[ ]= {0, 1, -1, 0};int yy[ ]= {1, 0, 0, -1};int hash[10][10];struct node{ int x, y, t, n; /*bool operator &l 阅读全文

posted @ 2011-08-09 20:19 more think, more gains 阅读(136) 评论(0) 推荐(0) 编辑

Asteroids! hdu 1240

摘要: 三维空间的简单BFS....#include <stdio.h>#include <string.h>#include <stdlib.h>#include <queue>#include <iostream>using namespace std;char map[20][20][20];int N, a, b, c, d, e, f, f1;int xx[ ] = {0, 1, 0, -1, 0, 0};int yy[ ] = {1, 0, -1, 0, 0, 0};int zz[ ] = {0, 0, 0, 0 , 1, -1} 阅读全文

posted @ 2011-08-09 18:14 more think, more gains 阅读(150) 评论(0) 推荐(0) 编辑

Knight Moves BFS 水题

摘要: #include <stdio.h>#include <string.h>#include <stdlib.h>#include <queue>#include <algorithm>using namespace std;int xx[ ] = {1,2,-1,-2,-2,-1,1,2};int yy[ ] = {2,1,-2,-1,1,2,-2,-1};int map[10][10];int a, b, c, d, f1 = 0;int judge( int x, int y){ if ( x < 1 || x > 8 阅读全文

posted @ 2011-08-09 17:10 more think, more gains 阅读(196) 评论(0) 推荐(0) 编辑

非常可乐 hdu 1495

摘要: 此题需要注意的是。最后的判断条件应是。。S == M + N ..刚开始把判断条件搞错了。认为只要任意两杯相加与第三杯相等即可。。悲剧啊。改了我一个多时侯。改来改去还是测试数据还是2.。。最后把测试数据手算下才知道。。判断条件写错了。。代码写得有点差。。#include <stdio.h>#include <string.h>#include <stdlib.h>#include <queue>using namespace std;int S, N, M, t;struct node{ int s, n, m, t; bool operator 阅读全文

posted @ 2011-08-09 16:38 more think, more gains 阅读(279) 评论(0) 推荐(0) 编辑

Rescue hdu 1242 BFS

摘要: 此题要注意的是多个。。r..还加优先队列。。才能保证每次到r才是最小时间的。RescueTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5900Accepted Submission(s): 2193Problem DescriptionAngel was caught by the MOLIGPY! He was put in prison by Moligpy. The prison is described as a N * M (N, 阅读全文

posted @ 2011-08-09 13:01 more think, more gains 阅读(220) 评论(0) 推荐(0) 编辑

诡异的楼梯 BFS hdu 1180

摘要: 这题好邪恶啊。做了两个半小时wa得好辛苦。原因是。。可以停留在空格里的。题意不清啊。还有就是注意标记。。开了个三维的数组。。分奇数步和偶数步标记。。最后有可能时间多的先出队。所以要选个最小的时间。。其实可以用优先队列做。。艾。。这代码有点太长了。。#include <stdio.h>#include <string.h>#include <stdlib.h>#include <deque>#include <algorithm>#include <iostream>using namespace std;int a, b, 阅读全文

posted @ 2011-08-09 11:08 more think, more gains 阅读(154) 评论(0) 推荐(0) 编辑

导航