Algorithm
problem Link : https://www.codechef.com/problems/EXPERT
Problem
A problem setter is called an expert if at least of their problems are approved by Chef.
Munchy submitted problems for approval. If problems out of those were approved, find whether Munchy is an expert or not.
Input Format
- The first line of input will contain a single integer , denoting the number of test cases.
- Each test case consists of a two space-separated integers and - the number of problems submitted and the number of problems that were approved by Chef.
Output Format
For each test case, output on a new line YES
, if Munchy is an expert. Otherwise, print NO
.
The output is case-insensitive. Thus, the strings YES
, yes
, yeS
, and Yes
are all considered the same.
Constraints
Sample 1:
4 5 3 1 1 4 1 2 1
YES YES NO YES
Explanation:
Test case : We are given that out of problems were approved. Thus, of the problems were approved. Since at least of the problems were approved, Munchy is an expert.
Test case : We are given that out of problems were approved. Thus, of the problems were approved. Since at least of the problems were approved, Munchy is an expert.
Test case : We are given that out of problems were approved. Thus, of the problems were approved. Since at least of the problems were not approved, Munchy is not an expert.
Test case : We are given that out of problems were approved. Thus, of the problems were approved. Since at least of the problems were approved, Munchy is an expert.
Code Examples
#1 Code Example with C Programming
Code -
C Programming
#include<stdio.h>
int main()
{
int t,x,y;
scanf("%d",&t);
while(t--)
{
scanf("%d %d",&x,&y);
if(((y*100)/x)>=50) printf("YES\n");
else printf("No\n");
}
}
Copy The Code &
Try With Live Editor
Input
5 3
1 1
4 1
2 1
Output
YES
NO
YES
Demonstration
CodeChef solution EXPERT - Expert Setter Codechef solution in Codechef solution in C,C++