|
|
back to boardtest 1 WA ?? Posted by Peca 6 Oct 2008 21:34 hi I don't understand why this is not good for test 1 . I obtain WA. Who can tell me what is not good. import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; import java.util.*; public class Main { public static void main(String[] args) { int nr = 0; int i; int suma=0; try { BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); nr = Integer.parseInt(stdin.readLine()); int []v = new int[nr]; Scanner scan = new Scanner(System.in); for (i=0;i<nr;i++) { v[i]= scan.nextInt(); } Arrays.sort(v); nr=nr/2+1; int n=0; for (i=0;i<nr;i++) { n=v[i]; suma=suma+((n/2)+1); } System.out.println(suma); } catch (Exception e) { e.getMessage(); } } } thanx |
|
|