import java.io.BufferedReader; import java.io.DataInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; public class kie { public static void main(String[] args) throws IOException { // BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); // String s = null; // try { // s = in.readLine(); // } catch (IOException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } Scanner sc = new Scanner(System.in); int n=sc.nextInt(); // System.out.print(n); // int n = Integer.parseInt(s); // try { // s = in.readLine(); // } catch (IOException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } // String[] parts = s.split(" "); int sum = 0; int min_odd = 1001; // int[] a = new int[n]; int a=0; for (int i=0; i<n; i++) { a=sc.nextInt(); // a[i] = Integer.parseInt(parts[i]); // sum += a[i]; // // if ((a[i] < min_odd) && (a[i] % 2 == 1)) { // min_odd = a[i]; // } // a = Integer.parseInt(parts[i]); sum += a; if ((a < min_odd) && (a % 2 == 1)) { min_odd = a; } } if (sum % 2 == 0){ System.out.println(sum); } else { // if (min_odd == 1001) if (sum - min_odd == 0) System.out.println("NIESTETY"); else System.out.println(sum - min_odd); } System.exit(0); } }
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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | import java.io.BufferedReader; import java.io.DataInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; public class kie { public static void main(String[] args) throws IOException { // BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); // String s = null; // try { // s = in.readLine(); // } catch (IOException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } Scanner sc = new Scanner(System.in); int n=sc.nextInt(); // System.out.print(n); // int n = Integer.parseInt(s); // try { // s = in.readLine(); // } catch (IOException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } // String[] parts = s.split(" "); int sum = 0; int min_odd = 1001; // int[] a = new int[n]; int a=0; for (int i=0; i<n; i++) { a=sc.nextInt(); // a[i] = Integer.parseInt(parts[i]); // sum += a[i]; // // if ((a[i] < min_odd) && (a[i] % 2 == 1)) { // min_odd = a[i]; // } // a = Integer.parseInt(parts[i]); sum += a; if ((a < min_odd) && (a % 2 == 1)) { min_odd = a; } } if (sum % 2 == 0){ System.out.println(sum); } else { // if (min_odd == 1001) if (sum - min_odd == 0) System.out.println("NIESTETY"); else System.out.println(sum - min_odd); } System.exit(0); } } |