Problem
Chef has been participating in World's Best Chef (WBC) for years in a row now. Chef calls his WBC career successful if the number of times he has won is strictly greater than the number of times he didn't. WBC takes place annually. Chef's WBC career is described as an array of containing elements. The element is if Chef has won in the year and otherwise.
Find if Chef's career was successful or not.
Input Format
- First line of input contains a single integer , number of testcases. The description of each test case follows.
- The first and the only line of each test case contains space-separated integers, of them is .
Output Format
For each test case print "Yes"
(without quotes) if Chef's career was successful and "No"
otherwise.
You may print each character of the string in uppercase or lowercase (for example, the strings "yEs"
, "yes"
, "Yes"
and "YES"
will all be treated as identical).
Constraints
Sample 1:
3 1 1 1 1 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
YES YES NO
Explanation:
- In the first test case, Chef has won times and lost times.
Program :
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner sc=new Scanner (System.in);
int t=sc.nextInt();
int n=7,i,j;
int a[]=new int[n];
while(t>0)
{
t--;
for(i=0;i<n;i++)
{
a[i]=sc.nextInt();
}
int count=0;
int zero=0;
for(i=0;i<n;i++)
{
if(a[i]==1)
{
count++;
}
else
{
zero++;
}
}
if(count>zero)
{
System.out.println("YES");
}
else
{
System.out.println("NO");
}
}
}
}
0 Comments