1sting 大数 递推】的更多相关文章

You will be given a string which only contains ‘1’; You can merge two adjacent ‘1’ to be ‘2’, or leave the ‘1’ there. Surly, you may get many different results. For example, given 1111 , you can get 1111, 121, 112,211,22. Now, your work is to find th…
                                                                              Computer Transformation                                                                                   Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/327…
题目链接: http://poj.org/problem?id=1737 题意: 求 \(n\) 个点的无向简单(无重边无自环)连通图的个数.\((n<=50)\) 题解: 这题你甚至能OEIS. http://oeis.org/A001187 但不支持这样做.TAT 间接做. 总方案数减去不合法方案. 因为\(n\)个点的完全图有 \(C(n,2)={n(n-1) \over 2}\) 条边,显然就有 \(2^{C(n,2)}\) 种子图,即枚举每条边是否选择. 设$ f[i]$ 表示每个点都…
1sting Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 7573    Accepted Submission(s): 2945 Problem Description You will be given a string which only contains ‘1’; You can merge two adjacent ‘1’…
https://vjudge.net/problem/UVA-10328 题意: 有H和T两个字符,现在要排成n位的字符串,求至少有k个字符连续的方案数. 思路:这道题目和ZOJ3747是差不多的,具体做法可以参考另一篇博客http://www.cnblogs.com/zyb993963526/p/7203833.html 但是这道题目的话是要用大数来做的,c++感觉不太好写,就学了下java的做法. import java.math.BigInteger; import java.util.S…
#include<iostream> #include<cstdio> #include<cstring> #include<string> #include<cmath> #include<algorithm> #include<map> #include<set> #include<vector> #include<queue> #include<stack> //#in…
Buy the Ticket Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4185    Accepted Submission(s): 1759 Problem Description The "Harry Potter and the Goblet of Fire" will be on show in the next…
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1865 本题的关键是找递推关系式,由题目,可知前几个序列的结果,序列长度为n=1,2,3,4,5的结果分别是,f(1)=1,f(2)=2,f(3)=3,f(4)=5,f(5)=8,所以猜测,递推关系式为: f(n)=f(n-1)+f(n-2),n>=3,f(1)=1,f(2)=2; 序列长度不超过200,即n的值不超过200,则估计f(n)的值得位数不超过1000位.在代码中,我们采用10000进制的方法…
Description In how many ways can you tile a 2xn rectangle by 2x1 or 2x2 tiles? Here is a sample tiling of a 2x17 rectangle. Input Input is a sequence of lines, each line containing an integer number 0 <= n <= 250. Output For each line of input, outp…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1297 题目大意: 有n个同学, 站成一排, 要求 女生最少是两个站在一起, 问有多少种排列方式. 题目分析: 1.  假设第n个学生是个男生, 我们可以直接将他放在最后有 dp[n-1]种 即: ...............M   dp[n-1] 2.假设第n个放女生,要求两个女生在一起, 我们可以直接在最后放两个女生 即: .............FF    dp[n-2] 3.假设我们后面…