import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for (int i = 1; i <= 9; i++) { for (int j = 0; j <= 9; j++) { for (int k = 0; k <= 9; k++) { if (2 * i + 2 * j + k == n) System.out.println("" + i + j + k + j + i); } } } for (int i = 1; i <= 9; i++) { for (int j = 0; j <= 9; j++) { for (int k = 0; k <= 9; k++) { if (2 * i + 2 * j + 2 * k == n) System.out.println("" + i + j + k + k + j + i); } } } } }
解题思路:
注意事项:
参考代码:
0.0分
0 人评分