标签:
Description
Input
Output
Sample Input
7
Sample Output
6
Source
#include<stdio.h> #include<string.h> #define ll long long #define mod 1000000007 #define esp 0.00000000001 const int N=1e5+10,M=1e6+10,inf=1e9; int a[22]={1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288}; int dp[M]; int main() { int x,y,z,i,t; memset(dp,0,sizeof(dp)); dp[0]=1; for(i=0;i<20;i++) { for(t=a[i];t<=1000000;t++) dp[t]+=dp[t-a[i]],dp[t]%=inf; } while(~scanf("%d",&x)) printf("%d\n",dp[x]); return 0; }
标签:
原文地址:http://www.cnblogs.com/jhz033/p/5604864.html