PROBLEM LINK:
Setter: Abhinav Gupta
Tester: Satyam, Jatin Garg
Editorialist: Kiran
DIFFICULTY:
424
PREREQUISITES:
None
PROBLEM:
Chef scored A marks in Section 1, B marks in section 2, and C marks in section 3.
Chef passes the exam if both of the following conditions satisfy:
- Total score of Chef is ≥100;
- Score of each section ≥10.
The objective is to determine whether Chef passes the exam or not
EXPLANATION:
-
The objective of this problem is to input three distinct values and compare if:
a. All the received inputs are ≥10.
b. The sum of these inputs are ≥ 100. -
Solution:
-
If the conditions (a) and (b) are satisfied Chef passes the exam
-
If either of the conditions fails, Chef fails the exam
TIME COMPLEXITY:
O(1)
SOLUTION:
Editorialist's Solution
int t;
cin>>t;
for(int i=0;i<t;i++)
{
int a,b,c,d=0,e;
cin>>a>>b>>c;
if(a>=10 && b>=10 && c>=10)
d=1;
e=a+b+c;
if(d==1 && e>=100)
cout<<"Pass"<<"\n";
else
cout<<"Fail"<<"\n";
}```