标签:des style blog http java color
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 2244 Accepted Submission(s): 1119
#include <stdio.h> #include <string.h> int prime[205],vis[205],cout,dp[205]; void GetPrime() { int i,j; cout = 0; memset(vis,0,sizeof(vis)); for(i = 2 ; i<=200; i++) { if(!vis[i]){ prime[cout++] = i; for(j = i+i; j<= 200 ; j+=i) vis[j] = 1; } } } int main() { int t,n,i,j,ans; GetPrime(); // for(i = 0 ; i <cout ; i++) printf("%d\n",prime[i]); memset(dp,0,sizeof(dp)); dp[0] = 1; for(i = 0 ; i <cout ; i++) for(j = prime[i] ; j<=200 ;j++) dp[j]+=dp[j-prime[i]]; scanf("%d",&t); while(t--) { scanf("%d",&n); printf("%d\n",dp[n]); } return 0; }
标签:des style blog http java color
原文地址:http://www.cnblogs.com/llei1573/p/3850308.html