** Questions basic exercises special palindrome **

Questions basic exercises special palindrome

Problem Description
  123321 is a very special number, it is read from left to right and read from the same.
  Enter a positive integer n, find all such programming five and six decimal numbers, figures and meet all equal to n.
Input format
  input line, contains a positive integer n.
Output format
  in order from small to large outputs an integer satisfying the condition, each integer per line.
Input Sample
52
Sample Output
899 998
989 989
998 899
data size and Conventions
  1 <= n <= 54.
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int a,b,c,d,e,f;
int n=sc.nextInt();
if(1<=n&&n<=54) {
for(a=1;a<10;a++) {
for(b=0;b<10;b++) {
for(c=0;c<10;c++) {
for(d=0;d<10;d++) {
for(e=0;e<10;e++) {
int num=a+b+c+d+e;
if(ae&&bd&&nnum) {
int sum=a10000+b1000+c100+d10+e;
System.out.println(sum);
}
for(f=0;f<10;f++) {
int num1=a+b+c+d+e+f;
if(a
f&&be&&nnum1&&c==d) {
int sum1=a100000+b10000+c1000+d100+e*10+f;
System.out.println(sum1);
}
}
}
}
}
}
}
}}}

Published 10 original articles · won praise 3 · Views 130

Guess you like

Origin blog.csdn.net/wstrhok/article/details/104301280