|
|
back to boardMy code showing Run time error Non zero exit code. Why? 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); } } |
|
|