-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgood weather
60 lines (52 loc) · 1.68 KB
/
good weather
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Problem
The weather report of Chefland is Good if the number of sunny days in a week is strictly greater than the number of rainy days.
Input Format
First line will contain T, number of testcases. Then the testcases follow. Each testcase contains of a single line of input, 7 space separated integers
Output Format
For each testcase, print "YES" if the weather report of Chefland is Good, otherwise print "NO". Print the output without quotes.
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).
Input Output
4
1 0 1 0 1 1 1 YES
0 1 0 0 0 0 1 NO
1 1 1 1 1 1 1 YES
0 0 0 1 0 0 0 NO
Explanation:
Test case 1: The number of sunny days is 5 and the number of rainy days is 2. Hence the weather report of Chefland is Good.
Test case 2: The number of sunny days is 1 and the number of rainy days is 6. Hence the weather report of Chefland is not Good.
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
{
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
for(int i=0;i<t;i++){
int a[]=new int[7];
int c0=0;
int c1=0;
for(int k=0;k<7;k++)
{
a[k]=sc.nextInt();
if(a[k]==0)
{
c0++;
}
if(a[k]==1){
c1++;
}
}
if(c0>c1)
{
System.out.println("no");
}
else
{
System.out.println("yes");
}
}// your code goes here
}
}