考虑加多一颗树,这样的话当加的树放了k(0#include #include #include #include using namespace std;typedef long long ll;ll n,m,p;ll POW(ll x,ll n,ll p){ ll res=1; whi...
分类:
其他好文 时间:
2014-09-23 17:04:34
阅读次数:
264
Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 565Accepted Submission(s): 210Problem Description《...
分类:
其他好文 时间:
2014-09-23 01:04:53
阅读次数:
372
HDU 5025 Saving Tang Monk(BFS+状压)...
分类:
其他好文 时间:
2014-09-22 19:09:23
阅读次数:
225
HDU 5025 Saving Tang Monk
题目链接
思路:记忆化广搜,vis[x][y][k][s]表示在x, y结点,有k把钥匙了,蛇剩余状态为s的步数,先把图预处理出来,然后进行广搜即可
代码:
#include
#include
#include
using namespace std;
const int INF = 0x3f3f3f3f;
con...
分类:
其他好文 时间:
2014-09-22 18:39:13
阅读次数:
221
给出一个N*N的矩阵,开启牢门需要收集齐m种钥匙,且必须收集了前i-1种钥匙才能收集第i种钥匙,最终收集齐了回到关押唐僧的房间拯救唐僧,经过一个'S'的房间时需要额外耗时把蛇打死,蛇最多5条,所以状压一下用优先队列BFS求最小时间即可。
#include
#include
#include
#include
#include
#include
#include
#define in...
分类:
其他好文 时间:
2014-09-21 19:58:21
阅读次数:
314
Problem Description
《Journey to the West》(also 《Monkey》) is one of the Four Great Classical Novels of Chinese literature. It was written by Wu Cheng'en during the Ming Dynasty. In this novel, Monkey ...
分类:
其他好文 时间:
2014-09-21 11:56:50
阅读次数:
398
http://acm.hdu.edu.cn/showproblem.php?pid=5025
搜索题:注意蛇的状态(第一次路过要杀掉蛇花2s,第二次以后1s),钥匙状态处理好即可。
代码:
#include
#include
#include
#include
#include
#include
#include
#include
#define MOD 1000000007
typedef...
分类:
其他好文 时间:
2014-09-20 22:58:29
阅读次数:
326
题目链接
题意:给出n*n的网格,有且只有一个K(孙悟空)和一个T(唐僧),最多有m把钥匙,最多5条蛇,每走一格的时间为1,走到蛇的格子(杀蛇时间为1)的时间为2,取钥匙要按照顺序来,问能救到唐僧,如果可以输出最短时间。
思路:bfs求最小值。开四维数组作为标记,后两维分别为取到的钥匙数,以及蛇的状态。
代码:
#include
#include
#includ...
分类:
其他好文 时间:
2014-09-20 21:52:09
阅读次数:
176
Problem Description
《Journey to the West》(also 《Monkey》) is one of the Four Great Classical Novels of Chinese literature. It was written by Wu Cheng'en during the Ming Dynasty. In this novel, Monkey...
分类:
其他好文 时间:
2014-09-20 21:31:39
阅读次数:
247
Problem Description
《Journey to the West》(also 《Monkey》) is one of the Four Great Classical Novels of Chinese literature. It was written by Wu Cheng'en during the Ming Dynasty. In this novel, Monke...
分类:
其他好文 时间:
2014-09-20 20:18:49
阅读次数:
215