hdu题解
文章平均质量分 75
mathfinder
这个作者很懒,什么都没留下…
展开
-
hdu 1258题解
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1258 在数列进入dfs函数之前非递增排序,即可保证按要求输出。 在回溯的时候把该节点相同的数过滤掉,即可保证不重复。 #include #include #include #include using namespace std; const int N = 10000; int sum原创 2015-04-03 21:36:14 · 329 阅读 · 0 评论 -
hdu 1485 非常可乐 题解
参见小白书130页-131页,关键是在状态的存储,一开始用L*100+M*10+S存储每一个状态,L,M,S分别表示第一个第二个第三个杯子所含的可乐的量,不能过,因为这样的编码有重复。 #include #include #include #include using namespace std; const int N = 105; typedef int state[3]; int原创 2015-04-04 12:09:01 · 558 阅读 · 0 评论 -
hdu1010题解
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1010 先枚举总步数,即开门周期的倍数,T,2*T,3*T,....iT 如下代码: for(int i = T;i然后进入dfs后各种剪枝: if(ok)return; if(u == en && num == iT){ok = 1;return;}///到达 if(num > iT)retur原创 2015-04-04 16:53:37 · 489 阅读 · 0 评论 -
hdu 1426
裸dps,输入姿势对了才能过 #include #include #include using namespace std; const int N = 9; int maps[N][N]; int visr[N][N+1]; int visc[N][N+1]; int visf[N][N][N+1]; int blank[N*N]; int flag = 0; int num; vo原创 2015-04-03 20:17:00 · 351 阅读 · 0 评论