import java.util.Scanner;
public class Main{
public static void main(String[] args) {
Scanner scanner=new Scanner(System.in);
int n=scanner.nextInt();
for(int a=1;a<=9;a++) {
for(int b=0;b<=9;b++) {
for(int c=0;c<=9;c++) {
for(int d=0;d<=9;d++) {
for(int e=1;e<=9;e++) {
if((10000*a+1000*b+100*c+10*d+e==10000*e+1000*d+100*c+10*b+a)&&(a+b+c+d+e==n))
System.out.println(10000*a+1000*b+100*c+10*d+e);
}
}
}
}
}
for(int a=1;a<=9;a++) {
for(int b=0;b<=9;b++) {
for(int c=0;c<=9;c++) {
for(int d=0;d<=9;d++) {
for(int e=0;e<=9;e++) {
for(int f=1;f<=9;f++) {
if((100000*a+10000*b+1000*c+100*d+10*e+f==100000*f+10000*e+1000*d+100*c+10*b+a)&&(a+b+c+d+e+f==n))
System.out.println(100000*a+10000*b+1000*c+100*d+10*e+f);
}
}
}
}
}
}
scanner.close();
}
}
特殊回文数
最新推荐文章于 2019-12-04 16:41:40 发布