标签:
import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int tag = 0; int sum1 = 0; int sum2 = 0; for(int i = 1; i < 10; i++) { for(int j = 0; j < 10; j++) { for(int k = 0; k < 10; k++) { sum1 = (i + j) * 2 + k; if(sum1 == n) { System.out.println("" + i + j + k + j + i); tag++; } } } } for(int i = 1; i < 10; i++) { for(int j = 0; j < 10; j++) { for(int k = 0; k < 10; k++) { sum2 = (i + j + k) * 2; if(sum2 == n) { System.out.println("" + i + j + k + k + j + i); tag++; } } } } if(tag == 0) { System.out.println("-1"); } } }
标签:
原文地址:http://blog.csdn.net/l243225530/article/details/45543099