2015年4月17日

POJ 3278 Catch That Cow(bfs)

摘要: 题意:给定n,k两个数,三种操作,加一,减一,乘2,求n到k的最少步数;思路:广搜求最少步数;#include#include#includeusing namespace std;int n,m;int q[500010];int num[500010];int bfs(){ int b=0... 阅读全文

posted @ 2015-04-17 22:37 大树置林 阅读(121) 评论(0) 推荐(0) 编辑

poj 3009 curling2.0 (dfs)

摘要: 题意:一幅冰壶游戏地图中有起点,终点,墙,空地,每次从起点出发,求到达终点的最少步数;每次移动碰墙停止且墙消失,越出地图或步数大于10则失败;思路:用bfs不太好写,dfs暴搜;#include#include#includeusing namespace std;int n,m,s1,s2,num... 阅读全文

posted @ 2015-04-17 08:25 大树置林 阅读(95) 评论(0) 推荐(0) 编辑

导航