标签:des style blog java color strong
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 2508 Accepted Submission(s): 849
1 #include <stdio.h> 2 #include <string.h> 3 #include <algorithm> 4 #include <set> 5 using namespace std; 6 7 main() 8 { 9 int a, b, c, n, k, num, i, j; 10 int ans[10000]; 11 while(scanf("%d",&n)==1&&n) 12 { 13 num=0; 14 for(k=1;k<=n;k*=10) 15 { 16 c=n/k/11; 17 b=n/k%11; 18 if((b+c)!=0&&b<10) 19 { 20 a=(n-b*k-c*k*11)/2; 21 if(n==2*a+b*k+c*k*11) 22 { 23 ans[num++]=a+b*k+c*k*10; 24 } 25 } 26 b--; 27 if((b+c)!=0&&b>=0) 28 { 29 a=(n-b*k-c*k*11)/2; 30 if(n==2*a+b*k+c*k*11) 31 { 32 ans[num++]=a+b*k+c*k*10; 33 } 34 } 35 } 36 if(num==0) { 37 printf("No solution.\n"); 38 continue; 39 } 40 sort(ans,ans+num); 41 printf("%d",ans[0]); 42 for(i=1;i<num;i++) 43 { 44 if(ans[i]!=ans[i-1]) 45 printf(" %d",ans[i]); 46 } 47 printf("\n"); 48 49 } 50 }
标签:des style blog java color strong
原文地址:http://www.cnblogs.com/qq1012662902/p/3841091.html