摘要:
算法提高 概率计算 时间限制:1.0s 内存限制:256.0MB问题描述 生成n个∈[a,b]的随机整数,输出它们的和为x的概率。输入格式 一行输入四个整数依次为n,a,b,x,用空格分隔。输出格式 输出一行包含一个小数位和为x的概率,小数点后保留四位小数样例输入2 1 3 4样例输出0.... 阅读全文
摘要:
[原]【Usaco Nov08 Gold】 安慰奶牛2014-5-26阅读159评论0DescriptionFarmer John变得非常懒, 他不想再继续维护供奶牛之间供通行的道路. 道路被用来连接N (5 #include #include #include #include #include ... 阅读全文
摘要:
问题描述有n个格子,从左到右放成一排,编号为1-n。共有m次操作,有3种操作类型:1.修改一个格子的权值,2.求连续一段格子权值和,3.求连续一段格子的最大值。对于每个2、3操作输出你所求出的结果。输入格式第一行2个整数n,m。接下来一行n个整数表示n个格子的初始权值。接下来m行,每行3个整数p,x... 阅读全文
摘要:
平方和 n(n+1)(2n+1)/6推导:(n+1)^3-n^3=3n^2+3n+1, n^3-(n-1)^3=3(n-1)^2+3(n-1)+1 .............................. 3^3-2^3=3*(2^2)+3*2+1 2^3-1^3=3*(1^2)... 阅读全文
摘要:
242 - Stamps and Envelope SizeTime limit: 3.000 secondsStamps and Envelope SizePhilatelists have collected stamps since long before postal workers wer... 阅读全文
摘要:
1629 - Cake slicingTime limit: 3.000 secondsA rectangular cake with a grid ofm*nunit squares on its top needs to be sliced into pieces. Several cherri... 阅读全文
摘要:
1631 LockerA password locker with N digits, each digit can be rotated to 0-9 circularly.You can rotate 1-3 consecutive digits up or down in one step.F... 阅读全文
摘要:
1639 - CandyTime limit: 3.000 seconds1639 CandyLazyChild is a lazy child who likes candy very much. Despite being very young, he has two large candy b... 阅读全文
摘要:
11624 - Fire!Time limit: 1.000 secondsJoe works in a maze. Unfortunately, portions of the maze havecaught on re, and the owner of the maze neglected ... 阅读全文
摘要:
记忆化搜索/递归式动态规划:1.记忆化搜索的思想记忆化搜索的思想是,在搜索过程中,会有很多重复计算,如果我们能记录一些状态的答案,就可以减少重复搜索量2、记忆化搜索的适用范围根据记忆化搜索的思想,它是解决重复计算,而不是重复生成,也就是说,这些搜索必须是在搜索扩展路径的过程中分步计算的题目,也就是“... 阅读全文