import java.util.Scanner; class jed { public static void main(String args[]) { Scanner keyboard = new Scanner(System.in); int n = keyboard.nextInt(); int [] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = keyboard.nextInt(); } for(int i= 0; i< n; i++){ if(a[i] < 100) System.out.println(numberSumString(a[i])); } System.exit(0); } private static String numberSumString(int i){ StringBuilder sb = new StringBuilder("(1"); for(int j = 0; j< i - 1 ; j++){ sb.append("+1"); } sb.append(")"); return sb.toString(); } }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | import java.util.Scanner; class jed { public static void main(String args[]) { Scanner keyboard = new Scanner(System.in); int n = keyboard.nextInt(); int [] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = keyboard.nextInt(); } for(int i= 0; i< n; i++){ if(a[i] < 100) System.out.println(numberSumString(a[i])); } System.exit(0); } private static String numberSumString(int i){ StringBuilder sb = new StringBuilder("(1"); for(int j = 0; j< i - 1 ; j++){ sb.append("+1"); } sb.append(")"); return sb.toString(); } } |