标签:des style blog http color io os ar java
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 8234 Accepted Submission(s): 3705
1 #include<cstdio> 2 #include<cstdlib> 3 #include<cstring> 4 int dp[21][191]; 5 int main() 6 { 7 int n; 8 memset(dp,0,sizeof(dp)); 9 for(int i=1;i<=20;i++) 10 { 11 dp[i][0]=1; 12 for(int j=0;j<=i;j++) 13 { 14 for(int k=0;k<=i*(i-1)/2;k++) 15 { 16 if(dp[j][k]) 17 dp[i][(i-j)*j+k]=1; 18 } 19 } 20 } 21 while(scanf("%d",&n)!=EOF){ 22 printf("0"); 23 for(int i=1;i<=n*(n-1)/2;i++) 24 if(dp[n][i]) printf(" %d",i); 25 printf("\n"); 26 } 27 return 0; 28 }
标签:des style blog http color io os ar java
原文地址:http://www.cnblogs.com/gongxijun/p/4003024.html