import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class kie { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader bi = new BufferedReader(new InputStreamReader(System.in)); long sum = 0; long b = 0; long minN = 9999; String line; line = bi.readLine(); line = bi.readLine(); for(String nom1 : line.split("[ \t]")) { b = Long.parseLong(nom1); sum+=b; if(b%2==1 && minN>b) minN = b; } if(sum%2==1 && minN<9999) sum-=minN; System.out.println(sum==0?"NIESTETY":sum); } }
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 | import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class kie { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader bi = new BufferedReader(new InputStreamReader(System.in)); long sum = 0; long b = 0; long minN = 9999; String line; line = bi.readLine(); line = bi.readLine(); for(String nom1 : line.split("[ \t]")) { b = Long.parseLong(nom1); sum+=b; if(b%2==1 && minN>b) minN = b; } if(sum%2==1 && minN<9999) sum-=minN; System.out.println(sum==0?"NIESTETY":sum); } } |