码迷,mamicode.com
首页 >  
搜索关键字:uva 10200 prime tim    ( 11153个结果
C/C++时间函数的使用
来源:http://blog.csdn.net/apull/article/details/5379819一、获取日历时间time_t是定义在time.h中的一个类型,表示一个日历时间,也就是从1970年1月1日0时0分0秒到此时的秒数,原型是:typedef long time_t; /* tim...
分类:编程语言   时间:2014-07-17 22:07:15    阅读次数:507
UVA 11346 - Probability(概率)
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
UVA 11291 - Smeech(概率+词法分析)
UVA 11291 - Smeech 题目链接 题意:给定一个表达式形如e=(p,e1,e2) 该表达式的值为 p?(e1+e2)+(1?p)?(e1?e2),求出值 思路:题目是很水,但是处理起来还挺麻烦的,模拟写编译器LEX分析器原理去写了。 代码: #include #include const int N = 100005; char str[N];...
分类:其他好文   时间:2014-07-17 21:07:29    阅读次数:170
UVA 10168 Summation of Four Primes(数论)
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
UVA 12230 - Crossing Rivers(概率)
UVA 12230 - Crossing Rivers 题目链接 题意:给定几条河,每条河上有来回开的船,某一天出门,船位置随机,现在要求从A到B,所需要的期望时间 思路:每条河的期望,最坏就是船刚开走3L/V,最好就是直接上船L/V,期望为4L/V/2 = 2L/V,然后在算上陆地上的时间,就是答案 代码: #include #include int n; d...
分类:其他好文   时间:2014-07-17 19:29:44    阅读次数:223
UVa 1401 Remember the Word
Trie+DP 大白书上的字典树训练题。 题意是说一个字符串可能有多少种小串组成。 例如 abcd  4 a b cd ab abcd=a+b+cd;abcd=ab+cd; 递推为:从最后一位往前,dp[i]=dp[i]+dp[i+ len[x]]  x为输入时的顺序,附加到节点中。是 i~strlen(S)的前缀。S[1,2,3,…,i,…len] ...
分类:其他好文   时间:2014-07-17 19:26:33    阅读次数:277
POJ 2739 Sum of Consecutive Prime Numbers
?? Sum of Consecutive Prime Numbers Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 18782   Accepted: 10308 Description Some positive integers can be represen...
分类:其他好文   时间:2014-07-17 19:15:16    阅读次数:260
uva 568(数学)
题解:从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
UVA 10288 - Coupons(概率递推)
UVA 10288 - Coupons 题目链接 题意:n个张票,每张票取到概率等价,问连续取一定次数后,拥有所有的票的期望 思路:递推,f[i]表示还差i张票的时候期望,那么递推式为 f(i)=f(i)?(n?i)/n+f(i?1)?i/n+1 化简后递推即可,输出要输出分数比较麻烦 代码: #include #include #include lon...
分类:其他好文   时间:2014-07-17 19:12:07    阅读次数:189
UVA 10139 Factovisors(数论)
Factovisors The factorial function, n! is defined thus for n a non-negative integer: 0! = 1 n! = n * (n-1)! (n > 0) We say that a divides b if there exists an integer k such that k*a =...
分类:其他好文   时间:2014-07-17 19:05:06    阅读次数:235
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!