UVA 12293 - Box Game
题目链接
题意:两个盒子,一开始一个盒子有n个球,一个只有1个球,每次把球少的盒子中球消掉,把多的拿一些球给这个盒子,最后不能操作的输(球不能少于1个),Alice先手,问谁赢
思路:博弈,题目其实可以转化为,给定一个n,每次把减少1到n/2的数字,最后谁是1谁就输了,那么可以去递推前几项找个规律,或者推理,都可以发现只要是2^i - 1...
分类:
其他好文 时间:
2014-07-18 21:27:44
阅读次数:
186
uva548:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=489题意:给出一颗二叉树的中序遍历和后序遍历,求一条路径,这条路径从根...
分类:
其他好文 时间:
2014-07-18 20:21:14
阅读次数:
205
In a serious attempt to downsize (reduce) the dole queue, The New National Green Labour Rhinoceros Party has decided on the following strategy. Every ...
分类:
其他好文 时间:
2014-07-18 20:15:42
阅读次数:
234
Problem H
Morning Walk
Time Limit
3 Seconds
Kamalis a Motashotaguy. He has got a new job in Chittagong. So, he has moved to Chittagong fromDinajpur. He was getting fatter i...
分类:
其他好文 时间:
2014-07-18 17:01:16
阅读次数:
219
Description
Tree Recovery
Little Valentine liked playing with binary trees very much. Her favorite game was constructing randomly looking binary trees with capital letters i...
分类:
其他好文 时间:
2014-07-17 17:21:38
阅读次数:
253
UVA 11427 - Expect the Expected
题目链接
题意:玩一个游戏,赢的概率p,一个晚上能玩n盘,如果n盘都没赢到总赢的盘数比例大于等于p,以后都不再玩了,如果有到p就结束
思路:递推,dp[i][j]表示玩i盘,赢j盘的概率,那么一个晚上玩了n盘小于p的概率递推式为:
dp(i,j)=dp(i?1,j)?(1?p)+dp(i?1,j?1)?p
总和为...
分类:
其他好文 时间:
2014-07-17 16:30:01
阅读次数:
171
UVA 11762 - Race to 1
题意:给定一个n,每次随即选择一个n以内的质数,如果不是质因子,就保持不变,如果是的话,就把n除掉该因子,问n变成1的次数的期望值
思路:tot为总的质数,cnt为质因子个数,那么f(n)=(1?cnt/tot)?f(n)+∑f(n/prime)?(1/tot),然后利用记忆化搜索去做即可
代码:
#include
#inclu...
分类:
其他好文 时间:
2014-07-17 15:36:46
阅读次数:
211
UVA 11722 - Joining with Friend
题目链接
题意:你会在[t1,t2]时刻到,你朋友会在[s1,s2]时刻到,两个人都停留w,问两人碰面的概率
思路:概率题,画图,计算围成面积/总面积就是概率
代码:
#include
#include
int t;
double t1, t2, s1, s2, w;
double cal(dou...
分类:
其他好文 时间:
2014-07-17 15:31:30
阅读次数:
262
Where is the Marble? Where is the Marble?Raju and Meena love to play with Marbles. They have got a lot of marbles with numbers written on them. At the...
分类:
其他好文 时间:
2014-07-17 14:20:27
阅读次数:
376
Description
Current work in cryptography involves (among other things) large prime numbers and computing powers of numbers among these primes. Work in this area has resulted in the practical use of...
分类:
其他好文 时间:
2014-07-17 10:12:16
阅读次数:
191