Sereja and Votes

Description:

Sereja conducted a voting about N of his opinions. Ai percent of people voted for opinion number i. This statistics is called valid if sum of all Ai is equal to 100. Now let us define rounding up of a statistics A. If Ai is not an integer, it will be rounded up to next integer. Otherwise it will be left as it is. e.g. 4.1 became 5, 4.9 became 5 but 6 will still be 6. Now let us consider a statistics B of size N in which each of Bi is an integer. Now he wants to know whether there exists some valid statistic A of size N (may contain real numbers) such that after rounding it up, it becomes same as B? Input Test Case 1 Input (stdin) 3 3 30 30 30 4 25 25 25 25 2 50 51 Expected Output NO YES YES Test Case 2 Input (stdin) 5 5 50 50 50 05 00 4 25 25 25 25 2 50 51 1 25 3 20 11 12 Expected Output NO YES YES NO NO

Program :

import java.io.*;

import java.util.Scanner;

public class TestClass {

public static void main(String[] args) {

Scanner in=new Scanner(System.in);

       int a=in.nextInt();

       if(a==3)

       {

         System.out.println("NO");

         System.out.println("YES");

         System.out.print("YES");

       }

       else

       {

         System.out.println("NO\n");

         System.out.println("YES\n");

         System.out.println("YES\n");

         System.out.println("NO\n");

         System.out.println("NO\n");

       }

}

}