304 North Cardinal St.
Dorchester Center, MA 02124

Passing Marks CodeChef Solution

Problem – Passing Marks CodeChef Solution

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+CTmin​.

Given seven integers Amin​,Bmin​,Cmin​,Tmin​,A,B,C, tell whether Chef passes the semester or not.

###Input:

• The first line will contain T, number of testcases. Then the testcases follow.
• Each testcase contains of a single line of input, seven integers Amin​,Bmin​,Cmin​,Tmin​,A,B,C each separated by aspace.

###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

• 1≤T≤100
• 1≤Amin​,Bmin​,Cmin​,A,B,C≤100
• Amin​+Bmin​+Cmin​≤Tmin​≤300

Sample 1:

``````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``````

Explanation:

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.

Passing Marks CodeChef Solution in Pyth 3

``````# 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')``````

Passing Marks CodeChef Solution in C++17

``````#include <iostream>
using namespace std;

int main() {
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;
}
``````

Passing Marks CodeChef Solution in Java

``````/* 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
{
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");
}

}
}
}
``````
Passing Marks CodeChef Solution Review:

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

Find on CodeChef

Conclusion:

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 >>

LeetCode Solutions

Hacker Rank Solutions

CodeChef Solutions