标签:
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 16028 Accepted Submission(s): 11302
1 #include<stdio.h> 2 const int MAXN=10010; 3 int main(){ 4 int a[MAXN],b[MAXN],N; 5 while(~scanf("%d",&N)){ 6 int i,j,k; 7 for(i=0;i<=N;i++){ 8 a[i]=1;b[i]=0; 9 } 10 for(i=2;i<=N;i++){ 11 for(j=0;j<=N;j++) 12 for(k=0;k+j<=N;k+=i) 13 b[j+k]+=a[j]; 14 for(j=0;j<=N;j++) 15 a[j]=b[j],b[j]=0; 16 } 17 printf("%d\n",a[N]); 18 } 19 return 0; 20 }
Ignatius and the Princess III(母函数)
标签:
原文地址:http://www.cnblogs.com/handsomecui/p/4822964.html