Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Recently, Chef’s College Examination has concluded. He was enrolled in 3 courses and he scored A,B,C in them, respectively. To pass the semester, he must score at least Amin,Bmin,Cmin marks in the respective subjects along with a cumulative score of at least min, i.e, A+B+C≥Tmin.
Given seven integers Amin,Bmin,Cmin,Tmin,A,B,C, tell whether Chef passes the semester or not.
###Input:
###Output: Output in a single line, the answer, which should be “YES” if Chef passes the semester and “NO” if not.
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
Input:
5
1 1 1 300 2 2 2
3 2 2 6 2 2 2
2 3 2 6 2 2 2
2 2 3 6 2 2 2
100 100 100 300 100 100 100
Output:
NO
NO
NO
NO
YES
TestCase 1: Chef is passing in all the subjects individually but his total score (2+2+2=6) is much below the required threshold of 300 marks. So Chef doesn’t pass the semester.
TestCase 2: Chef’s score in the first subject is less than the threshold, so he doesn’t pass the semester.
TestCase 3: Chef’s score in the second subject is less than the threshold, so he doesn’t pass the semester.
TestCase 4: Chef’s score in the third subject is less than the threshold, so he doesn’t pass the semester.
TestCase 5: Chef is passing in all the subjects individually and also his total score is equal to the required threshold of 300 marks. So Chef passes the semester.
# cook your dish here
t=int(input())
for i in range(t):
a,b,c,d,e,f,g=map(int,input().split())
if (e+f+g)>=d and e>=a and f>=b and g>=c:
print('YES')
else:
print('NO')
#include <iostream>
using namespace std;
int main() {
// your code goes here
int n,t,a1,a2,b1,b2,c1,c2;
cin>>n;
while(n--)
{
cin>>a1>>b1>>c1>>t>>a2>>b2>>c2;
if(a1<=a2 && b1<=b2 && c1<=c2 && a2+b2+c2>=t)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}
return 0;
}
/* 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 n=sc.nextInt();
for(int i=0;i<n;i++){
int a=sc.nextInt();
int b=sc.nextInt();
int c=sc.nextInt();
int d=sc.nextInt();
int e=sc.nextInt();
int f=sc.nextInt();
int g=sc.nextInt();
int h;
h=e+f+g;
if(a<=e && b<=f && c<=g && d<=h){
System.out.println("YES");
}
else{
System.out.println("NO");
}
}
}
}
In our experience, we suggest you solve this Passing Marks CodeChef Solution and gain some new skills from Professionals completely free and we assure you will be worth it.
If you are stuck anywhere between any coding problem, just visit Queslers to get the Passing Marks CodeChef Solution
I hope this Passing Marks CodeChef Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.
This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.
Keep Learning!
More Coding Solutions >>