随笔分类 -  ACM

摘要:http://acm.hdu.edu.cn/showproblem.php?pid=4036一开始以为需要用斜抛,结果发现只需要用能量守恒定律?+与最大速度的坏土豆速度保持一致#include #include #include #include using namespace std;const ... 阅读全文
posted @ 2015-05-14 00:47 雪溯 阅读(173) 评论(0) 推荐(0) 编辑
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=4050题意:现在主角站在0处,需要到达大于n的位置主角要进入的格子有三种状态:0. 不能进入1. 能进入左脚,下一步出右脚2. 能进入右脚,下一步出左脚3. 两只脚都能进入,而且下一步迈出左右脚都可.也就是说,如果... 阅读全文
posted @ 2015-05-12 20:07 雪溯 阅读(188) 评论(0) 推荐(0) 编辑
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=4089这道题中一共有两个循环:1.事件1 如果一直落在Activation failed事件上,那么就会重新继续直到出现事件2,3,或4为止,这样 进入事件2的概率是p2'=p2+p2*p1+p2*p1*p1...... 阅读全文
posted @ 2015-05-12 01:27 雪溯 阅读(122) 评论(0) 推荐(0) 编辑
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=3076不可思议的题目,总之血量越少胜率越高,所以读取时把两人的血量交换一下明显每一轮的胜率和负率都是固定的,所以设psc为胜率,pls为负率,peq为平率,则在每一局中的胜率负率平率可以确定,而在有结果的一个阶段中... 阅读全文
posted @ 2015-05-07 17:41 雪溯 阅读(280) 评论(0) 推荐(0) 编辑
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=4035求步数期望,设E[i]为在编号为i的节点时还需要走的步数,father为dfs树中该节点的父节点,son为dfs树种该节点的子节点的集合,kl[i]为被杀掉的概率,ex[i]为逃出的概率mv[i]=(1-kl... 阅读全文
posted @ 2015-05-07 13:22 雪溯 阅读(124) 评论(0) 推荐(0) 编辑
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=4405明显,有飞机的时候不需要考虑骰子,一定是乘飞机更优设E[i]为分数为i时还需要走的步数期望,j为某个可能投出的点数如果从i向i-j推导,我们并不能确定i的转移方向,因为可能有两个i-j有飞机其目的地是i,所以... 阅读全文
posted @ 2015-05-05 16:58 雪溯 阅读(128) 评论(0) 推荐(0) 编辑
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=3085出的很好的双向bfs,卡时间,普通的bfs会超时题意方面:1. 可停留2. ghost无视墙壁3. 需要检查两次某个地点是否有ghost,正要到达的时候(t),以及即将启程的时候(t+1).在编程时需要注意的... 阅读全文
posted @ 2015-05-03 15:53 雪溯 阅读(241) 评论(0) 推荐(0) 编辑
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1560仔细读题(!),则可发现这道题要求的是一个最短的字符串,该字符串的不连续子序列中包含题目所给的所有字符串因为总共只有40个字符,可以尝试使用A*搜索1.存储状态时直接存储40个字符,每个字符4种可能是肯定不行... 阅读全文
posted @ 2015-04-09 23:18 雪溯 阅读(361) 评论(0) 推荐(0) 编辑
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2181只有20个城市,而且每个点的度数恰好是3,也就意味着,对于即将进入环中的点,入度1,出度2,下一个点只有两种可能暴力枚举出所有的路径,也不过3*2^18,之后对于每个点作为起点的情况分别调整即可#includ... 阅读全文
posted @ 2015-03-27 16:02 雪溯 阅读(589) 评论(0) 推荐(1) 编辑
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=3533一道普通的bfs,但是由于代码实现出了bug还是拖了很久甚至对拍了需要注意的是:1.人不能经过炮台2.能量耗尽时如果进入终点且终点没有炮弹也可以3.炮台会遮挡住别的炮弹前两点认为读题时不能确定#include... 阅读全文
posted @ 2015-03-27 15:58 雪溯 阅读(278) 评论(0) 推荐(0) 编辑
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=3567相比Eight,似乎只是把目标状态由确定的改成不确定的,但是康托展开+曼哈顿为h值的A*和IDA*都不过,而且也不好控制字典序换个角度想,虽然起始状态有很多,但是到底哪一位是1,哪一位是2不是最重要的,最重要... 阅读全文
posted @ 2015-03-19 23:04 雪溯 阅读(675) 评论(0) 推荐(0) 编辑
摘要:http://poj.org/problem?id=1077http://acm.hdu.edu.cn/showproblem.php?pid=1043X=a[n]*(n-1)!+a[n-1]*(n-2)!+...+a[i]*(i-1)!+...+a[1]*0! 其中,a[i]为整数,并且X=a[n... 阅读全文
posted @ 2015-03-17 12:57 雪溯 阅读(161) 评论(0) 推荐(0) 编辑
摘要:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1676对顶点i,j,起点s=1,终点t=n,可以认为题意要求一组01矩阵use[i][j],使得aveCost=sigma(use[i][j]*cost[i][j])/sigma(... 阅读全文
posted @ 2015-03-16 13:18 雪溯 阅读(215) 评论(0) 推荐(0) 编辑
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=5186题意是分别对每一位做b进制加法,但是不要进位模拟,注意:1 去掉前置0 2 当结果为0时输出0,而不是全部去掉#include #include #include using namespace std;co... 阅读全文
posted @ 2015-03-15 00:01 雪溯 阅读(154) 评论(0) 推荐(0) 编辑
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2612bfs两次就可将两个人到达所有kfc的时间求出,取两人时间之和最短的即可,这个有点不符合实情,题目应该出两人最大时间最小才对#include #include #include using namespace... 阅读全文
posted @ 2015-03-14 20:30 雪溯 阅读(156) 评论(0) 推荐(0) 编辑
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1495第三个杯子的盛水量可由前两个杯子得到,而前两个杯子状态总数在100*100以内,穷举可实现#include #include #include using namespace std;const int mx... 阅读全文
posted @ 2015-03-14 20:27 雪溯 阅读(657) 评论(0) 推荐(1) 编辑
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1241对每个还未访问的点bfs,到达的点都标为一块,最后统计有多少块即可#include #include #include using namespace std;const int maxn=101;const... 阅读全文
posted @ 2015-03-14 20:24 雪溯 阅读(116) 评论(0) 推荐(0) 编辑
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=4687此题求哪些边在任何一般图极大匹配中都无用,对于任意一条边i,设i的两个端点分别为si,ti,则任意一个极大匹配中都必然有si或ti至少一个点被匹配,当在图中去掉si,ti两个点时,匹配数会损失一个或两个.如果... 阅读全文
posted @ 2015-02-28 02:38 雪溯 阅读(162) 评论(0) 推荐(0) 编辑
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=4686当看到n为小于64位整数的数字时,就应该有个感觉,acm范畴内这应该是道矩阵快速幂Ai,Bi的递推式题目已经给出,Ai*Bi=Ax*Bx*(Ai-1*Bi-1)+Ax*By*Ai-1+Bx*Ay*Bi-1+A... 阅读全文
posted @ 2015-02-26 17:21 雪溯 阅读(206) 评论(0) 推荐(0) 编辑
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2062Subset sequenceTime Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Subm... 阅读全文
posted @ 2015-02-21 00:08 雪溯 阅读(394) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示