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

My code showing Run time error Non zero exit code. Why?
Posted by Md johirul Islam 30 May 2015 01:08
import java.util.Arrays;
import java.util.Scanner;


public class T1025 {

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int k=sc.nextInt();
        int [] a=new int[k];
        for(int i=0;i<k;i++)
        {
            a[i]=sc.nextInt();
        }
        Arrays.sort(a);
        int vote=0;
        int mid=k%2==0?k/2:k/2+1;
        for(int i=0;i<mid;i++)
        {
            vote+=a[i]/2+1;
        }
        System.out.println(vote);

    }

}