Basic Practice Special Palindrome number time limit: 1.0s memory Limit: 512.0MB problem description 123321 is a very special number, which reads from the left and reads the same from the right.
Enter a positive integer n, programming all such five-bit and six-bit decimal digits, satisfying the sum of the numbers equals N. Enter a row for the input format, including a positive integer n. The output format outputs an integer that satisfies the condition in a small to large order, and each integer occupies one row. Example input 52 sample output 899998
989989
998899 Data Scale and convention 1<=n<=54. Method of solving Problems: Set loop (10000->1000000), get the number of bits per digit, and compare the number of numbers entered. Converts a loop variable to a character array, reverse it, get a new string, and compare it to the original string (palindrome number if true). If the comparison results are true, the number of this palindrome is output.
Import Java.util.Scanner;
public class main{public
static void Main (string[] args) {
Scanner sc = new Scanner (system.in);
int number = Sc.nextint ();
int i,j,len,n;
int sumt = 0;
char []array = new char[6];
String strorigin = "";
String Strturn = "";
StringBuilder Stbturn = new StringBuilder ();
for (i = 10000 i < 1000000; i++) {
n = i;
Strorigin = integer.tostring (i);
Array = Strorigin.tochararray ();
while (n > 0) {
sumt + = n%;
n = n/10;
}
len = array.length;
for (j = len-1 J >= 0; j--) {
stbturn.append (array[j]);
Strturn = Stbturn.tostring ();
if (Strorigin.equals (Strturn)) {
if (sumt = number) {
System.out.println (i);
}
}
Stbturn = new StringBuilder ();
SUMT = 0;
}
}