摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1728 这题主要是解决一个多次访问取最优(转向次数最少)的问题,用vis数组记录每次访问的转向次数,当出现跟优解时此点再次入队。#include<cstdio>#include<queue>#include<iostream>usingnamespacestd;intm,n,lim,si,sj,ei,ej;inttur[5][2]={0,0,0,1,0,-1,-1,0,1,0,};charmap[101][101];intvis[101][101];structnode{i 阅读全文
posted @ 2011-11-29 21:18 追逐. 阅读(301) 评论(0) 推荐(1) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1253 题目不难,简单的BFS加一点剪枝,不过让人郁闷的是用G++提交一直CE,用C++一次AC。最后还是XSY发现的问题,将我保存时间的变量time改成了T然后就A掉了... 这下是记住了,以后再也不用time这名了!#include<cstdio>#include<queue>usingnamespacestd;inta,b,c,T;intmap[51][51][51];inttur[6][3]={-1,0,0,1,0,0,0,-1,0,0,1,0,0,0,1,0,0,-1};st 阅读全文
posted @ 2011-11-29 19:09 追逐. 阅读(235) 评论(0) 推荐(0) 编辑