RESULT - EDITORIAL

Problem link
Practice
Contest

Author: Pratik Suryawanshi

Editorialist: Pratik Suryawanshi

DIFFICULTY:

CAKEWALK

PREREQUISITES:

Nested if-else loop

PROBLEM:

shive result got declared today help shiv to check whether he is pass or fail in exam.
the condition of passing is shiv should get strictly more than 45 percentage in combine
result and should have more than 30 percent in each subject.

( each subject is of total 100 marks and there are only 5 subjects in all test cases)

print [PASS] if shive pass the exam, [FAIL] otherwise.

QUICK EXPLANATION:

Use nested if-else loop and check both condition of pass and fail

EXPLANATION:

Figure out whether shuive getting passing marks i.e greater 45 and more than 30 per subject

SOLUTIONS:

Setter's Solution

indent whole code by 4 spaces

#pragma GCC optimize(“Ofast”)
#pragma GCC target(“avx,avx2,fma”)
#pragma GCC optimization(“unroll-loops”)
#include <bits/stdc++.h>
using namespace std;
#define tc ll t sc cin >> t sc while (t–)
#define ff first
#define vp vector<pair<ll,ll>>
#define sc ;
#define ss second
#define srt sort
#define endl ‘\n’
#define pb push_back
#define pp pop_back
#define mp make_pair
#define modulo 1e9+7
#define ll long long int
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define INF 1001001001
const long double pi = 3.141592653;

typedef unsigned int ui;
typedef unsigned long long int ul;

int main()
{

#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
freopen("errorf.txt" , "w" , stderr) ;
#endif
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);

tc
{

ll a,b,c,d,e;
cin>>a>>b>>c>>d>>e;
float s = (a+b+c+d+e)/5;
if(s>45)
{
if(a>30 && b>30 && c>30 && d>30 && e>30)
{
cout << “PASS” << endl;
}
else
cout << “FAIL” << endl;
}
else
cout << “FAIL” << endl;
}
return 0;
}