标签:
#include<stdio.h> #include<string.h> #include<string> #include<math.h> #include<algorithm> #define LL long long #define PI atan(1.0)*4 #define DD doublea #define MAX 100100 #define mod 10007 using namespace std; int s[100]; int main() { int j,i,len,sum,k; int m,n; while(scanf("%d",&n)!=EOF) { for(i=10000;i<=99999;i++) { m=i;k=1; sum=0; while(m) { s[k++]=m%10; sum+=s[k-1]; m/=10; } if(s[1]==s[5]&&s[2]==s[4]&&sum==n) printf("%d\n",i); } for(i=100000;i<=999999;i++) { m=i;k=1; sum=0; while(m) { s[k++]=m%10; sum+=s[k-1]; m/=10; } if(s[1]==s[6]&&s[2]==s[5]&&s[3]==s[4]&&sum==n) printf("%d\n",i); } } return 0; }
标签:
原文地址:http://www.cnblogs.com/tonghao/p/5133959.html