hdu 4651 Partition 多校第五场
来源:互联网 发布:模仿神烦狗doge软件 编辑:程序博客网 时间:2024/05/16 08:51
参见五边形定理。。
点击打开链接
#include <cstdio>#include <cstring>#include <cstdlib>#include <cmath>#include <iostream>#include <map>#include <vector>#include <algorithm>#include <set>using namespace std;#define clr(a, x) memset(a, x, sizeof(a))#define rep(i, n) for (int i = 0; i < (int)(n); i++)#define REP(i,a,b) for(int i=a;i<=b;i++)const double pi = 3.1415926;const int mod = 1000000007;const int maxn = 100010;int p[maxn];int P(int k,int i){ int res=0; if(i-(3*k-1)*k/2>=0) res+=p[i-(3*k-1)*k/2]; if(i-(3*k+1)*k/2>=0) res+=p[i-(3*k+1)*k/2]; res%=mod; if(k&1) return res; else return -res;}int main(){ int n; p[0]=1; p[1]=1; p[2]=2; p[3]=3; for(int i=4;i<maxn;i++) { p[i]=0; for(int k=1;k<=i;k++) { if(i-0.5*(3*k-1)*k<-1) break; p[i]=(p[i]+P(k,i))%mod; } p[i]=(p[i]+mod)%mod; //printf("i=%d %d\n",i,p[i]); } int T; scanf("%d",&T); while(T--) { scanf("%d",&n); // int ans=solve(n); //double ans=1.0/(4.0*n*sqrt(3.0))*exp(pi*sqrt(2.0*n/3)); printf("%d\n",p[n]); }}//p(n,k) = p(n-1,k-1)+p(n-k,k)
- hdu 4651 Partition 多校第五场
- 2013 多校第五场 hdu 4651 Partition
- hdu 4602 Partition 多校第一场
- HDU 4649 多校第五场1007
- 2013 多校第一场 hdu 4602 Partition
- hdu 4602 partition 2013多校联合训练第一场
- HDU 4651 2013多校联合第5场 Partition 数论
- 多校第五场
- hdu 4647 Another Graph Game 多校第五场
- 2013 多校第五场 hdu 4648 Magic Pen 6
- hdu 4649 Professor Tian 多校第五场
- 2013 多校第五场 hdu 4647 Another Graph Game
- 2013 多校第五场 hdu 4649 Professor Tian
- hdu 4915 Parenthese sequence 多校第五场
- hdu 4920 Matrix multiplication 2014多校第五场1010
- hdu 4911 Inversion 多校第五场 求逆序数
- 2016多校第五场 1001 HDU 5781 DP
- hdu 5791 two 多校联赛第五场
- cf聊天室,cf聊天室下载
- 打印调用堆栈
- ZOJ-1109 -Language of FatMouse
- 内存卡修复器,内存卡修复器下载
- 神剑情天3补丁,神剑情天3补丁下载
- hdu 4651 Partition 多校第五场
- 内核模块相关命令:lsmod,depmod,modprob...
- 模拟键盘输入和鼠标输入
- emucheat,emucheat下载
- hdu 4647——Another Graph Game
- UIWebView清除缓存和cookie
- Eclipse svn插件使用代理
- Jsmooth Java文件打包成exe文件(可以在没安装JDK的环境下运行)
- RGB转Lab的那些事(一)