|
|
back to boardPlease, Help me! WA on #5 import java.util.Scanner; public class Main { public static void main(String args[]) { try { Scanner in = new Scanner(System.in);
int[] group = new int[in.nextInt()]; for(int i=0; i<group.length; i++) { group[i] = in.nextInt(); } int per; for(int i=0; i<group.length - 1; i++) { for(int j=1; j<group.length; j++) { if (group[i] >= group[j]) { per = group[i]; group[i] = group[j]; group[j] = per; } } } int sum = 0; for(int i=0; i<group.length/2 + 1; i++) { sum += group[i]/2 + 1; } System.out.println(sum); in.close(); } catch(Exception e) { System.out.println("Error"); } } } |
|
|