import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.StreamTokenizer; public class kie { private static String result() { int minOdd = 1000000001; int sum = 0; int nextInt = 0; InputStreamReader isr = new InputStreamReader(System.in); StreamTokenizer st = new StreamTokenizer(new BufferedReader(isr)); try { st.nextToken(); int n = (int) st.nval; for (int i = 0; i < n; i++) { st.nextToken(); nextInt = (int) st.nval; sum += nextInt; if (nextInt % 2 == 1) { minOdd = Math.min(minOdd, nextInt); } } // isr.close(); if (sum % 2 == 0) return Integer.toString(sum); if (n == 1) return "NIESTETY"; return Integer.toString(sum - minOdd); } catch (Exception e) { } return "NIESTETY"; } public static void main(String[] args) { System.out.println(result()); 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 | import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.StreamTokenizer; public class kie { private static String result() { int minOdd = 1000000001; int sum = 0; int nextInt = 0; InputStreamReader isr = new InputStreamReader(System.in); StreamTokenizer st = new StreamTokenizer(new BufferedReader(isr)); try { st.nextToken(); int n = (int) st.nval; for (int i = 0; i < n; i++) { st.nextToken(); nextInt = (int) st.nval; sum += nextInt; if (nextInt % 2 == 1) { minOdd = Math.min(minOdd, nextInt); } } // isr.close(); if (sum % 2 == 0) return Integer.toString(sum); if (n == 1) return "NIESTETY"; return Integer.toString(sum - minOdd); } catch (Exception e) { } return "NIESTETY"; } public static void main(String[] args) { System.out.println(result()); System.exit(0); } } |