ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1025. Democracy in Danger

test 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