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
UVA 11346 - Probability
题目链接
题意:给定a,b,s要求在[-a,a]选定x,在[-b,b]选定y,使得(0, 0)和(x, y)组成的矩形面积大于s,求概率
思路:这样其实就是求xy > s的概率,那么画出图形,只要求y = s / x的原函数, y = slnx,带入两点相减就能求出面积,面积比去总面积就是概率
代码:
#include ...
分类:
其他好文 时间:
2014-07-17 21:15:07
阅读次数:
241
Summation of Four Primes
Input: standard input
Output: standard output
Time Limit: 4 seconds
Euler proved in one of his classic theorems that prime numbers are infinite in number. But can every nu...
分类:
其他好文 时间:
2014-07-17 21:05:16
阅读次数:
299
题解:从1开始乘到n,因为结果只要最后一位,所以每乘完一次,只要保留后5位(少了值会不准确,刚开始只保留了一位,结果到15就错了,保留多了int会溢出,比如3125就会出错) 和下一个数相乘,接着保留5位,注意5位没有后导零,最后取5位中最后一个不是零的就可以了。
#include
#include
using namespace std;
int main() {
int n;
...
分类:
其他好文 时间:
2014-07-17 19:14:19
阅读次数:
181
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