You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
433 B

#include<bits/stdc++.h>
using namespace std;
int main () {
int n,k,j,m;
int a[6];
long int i,t;
scanf("%d",&n);
if(n==1) {
printf("00100");
} else {
for(i=10000; i<1000000; i++) {
k=0;
t=i;
m=0;
while(t) {
a[k]=t%10;
t=t/10;
m+=a[k];
k++;
}
if(a[0]==a[k-1]&&a[1]==a[k-2]&&a[2]==a[k-3]&&m==n) {
for(j=0; j<k; j++)
printf("%d",a[j]);
printf("\n");
}
}
}
return 0;
}