2012年7月24日

hdu 1180 诡异的楼梯

摘要: 点击打开链接 复杂bfs... 需要讨论开始为 | 还是 - #include"stdio.h"#include"string.h"#include"queue"using namespace std;int dir[4][2]={1,0,0,1,-1,0,0,-1};int map[21][... 阅读全文

posted @ 2012-07-24 20:47 Slege 阅读(110) 评论(0) 推荐(0) 编辑

hdu 1372 Knight Moves

摘要: 点击打开链接 走的是日。。。 #include"stdio.h"#include"string.h"#include"queue"using namespace std;int dir[8][2]={{-2,1},{2,-1},{-1,2},{1,-2},{-1,-2},{-2,-1},{... 阅读全文

posted @ 2012-07-24 19:29 Slege 阅读(62) 评论(0) 推荐(0) 编辑

hdu 2822 dogs

摘要: 点击打开链接 BFS。。。 #include"stdio.h"#include"string.h"#include"queue"using namespace std;int dir[4][2]={{0,1},{0,-1},{1,0},{-1,0}};int map[1010][1010];ch... 阅读全文

posted @ 2012-07-24 19:27 Slege 阅读(90) 评论(0) 推荐(0) 编辑

hdu 1175 连连看

摘要: 点击打开链接 与1728类似,但写出来后一直超时。。。 最后把数组改为1001(原来为1024),就AC了。。 #include"stdio.h"#include"string.h"#include"queue"using namespace std;int dir[4][2]={1,0,... 阅读全文

posted @ 2012-07-24 19:25 Slege 阅读(89) 评论(0) 推荐(0) 编辑

hdu 1495 非常可乐

摘要: 点击打开链接 大意:有三个杯子,开始时第一个杯子装满水(体积为a)。。。。倒来倒去,得到其中2个杯里的水的体积都为 a/2。。。。求最小次数。。。。不存在就输出NO。。。。 从图(以前都是图题)的点转化成状态(这题比较现实化)。。。。 struct point//a,b,c是某一状态下三个... 阅读全文

posted @ 2012-07-24 19:20 Slege 阅读(164) 评论(0) 推荐(0) 编辑

hdu 1728 逃离迷宫

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1728 该死的杭电。读入的时候竟然先读入纵坐标。。。 开始以为是单纯的BFS,结果WA无数次.后来分析后发现因为是要找到最少转向路径,所以要每个方向搜到尽头. 两个AC代码。。 #include"st... 阅读全文

posted @ 2012-07-24 15:51 Slege 阅读(103) 评论(0) 推荐(0) 编辑

2012年7月20日

hdu 2612 Find a way

摘要: 点击打开链接 两个BFS即可。。 #include"stdio.h"#include"string.h"#include"queue"#define N 205using namespace std;char str[N][N];int n,m,a1[1004]={0},a2[1004]={... 阅读全文

posted @ 2012-07-20 10:22 Slege 阅读(90) 评论(0) 推荐(0) 编辑

hdu 1240 Asteroids!

摘要: 点击打开链接 因为没令str[d][e][f]='O',导致wrong了无数次。。。而且郁闷了好几天。。 #include"stdio.h"#include"string.h"#include"queue"#include"ctype.h"using namespace std;int map[... 阅读全文

posted @ 2012-07-20 09:06 Slege 阅读(105) 评论(0) 推荐(0) 编辑

2012年7月19日

hdu 1863 畅通工程

摘要: 题目连接 并查集+prime 第一次写prim。。。 #include"stdio.h"#define max 99999999int main(){ int map[100][100],dist[100]; int flag,ans; int i,j,k,t,temp; int ... 阅读全文

posted @ 2012-07-19 19:35 Slege 阅读(91) 评论(0) 推荐(0) 编辑

hdu 1233 还是畅通工程

摘要: /* Krusal 只与边的个数有关 算法: 1:将个边按权值大小进行排序 2: 遍历一次,找出最小权值的边,(条件:此次找出的边不能和已加入最小生成树集合的边构成环) 若符合条件,则加入最小生成树的集合中。不符合则继续找。 3:重复上述步骤,直到找到n-1条边(假设有n个节点) ... 阅读全文

posted @ 2012-07-19 19:35 Slege 阅读(102) 评论(0) 推荐(0) 编辑

导航