题解 | #回文对称数#
回文对称数
http://www.nowcoder.com/practice/5b143af8328f4e42adf5e10397ae44ef
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for (int i = 1; i <= n; i++) {
// 判断是否为回文数
String s = String.valueOf(i);
String result = "";
for (int j = s.length() - 1; j >= 0; j--) {
result += s.charAt(j);
}
if (result.equals(s)) {
System.out.println(i);
}
}
}
}