|
|
back to boardWhy WA? import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Scanner; public class DemocracyInDanger { private static int sum = 0; private static int i=0; public static void main(String[] args) { try { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int amount = Integer.parseInt(in.readLine()); if(amount>=1 && amount<=101 && amount%2!=0){ int[] party = new int[amount]; Scanner scanner = new Scanner(System.in); while(i<amount){ party[i]=scanner.nextInt(); if(party[i]>0 && party[i]%2!=0){ sum+=party[i]; }else throw new IOException(); i++; } if (sum<=9999){ sum=0; Arrays.sort(party); for (int i = 0; i <=amount/2; i++) { sum +=party[i]/2+1; } System.out.println(sum); } }
} catch (Exception e) { } } } |
|
|