蓝桥杯- 基础练习:特殊回文数
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int nextInt = scanner.nextInt(); for (int i = 10000; i < 999999; i++) { if (i<=99999) { if ((i/10000)==(i%10)&&(i/1000%10)==(i/10%10)&&((i/10000)+i/1000%10+i/100%10+i/10%10+i%10)==nextInt) { System.out.println(i); } } if (i>=100000) { if ((i/100000)==(i%10)&&(i/10000%10)==(i/10%10)&&(i/1000%10)==(i/100%10)&&(i/100000)+(i/10000%10)+(i/1000%10)+(i/100%10)+(i/10%10)+(i%10)==(nextInt)) { System.out.println(i); } } } } }