ATNSTATS-Editorial

PROBLEM LINK:

Practice
Setter: Charan Narukulla
Tester: Abhilash Movva

DIFFICULTY:

Cake-Walk

PREREQUISITES:

Math

PROBLEM:

Given classes attended by a student and classes conducted in total. Print his/her status based on the percentage of attendance.

EXPLANATION:

To get the status as described in the main problem calculate the percentage by percentage=(no of attended classses*100)/total number of classes conducted. print respective statement based on this result.

Setter's Solution

#include <bits/stdc++.h>
using namespace std;
int main(void) {
int N;
cin>>N;

while(N--){
    float P,T;
    cin>>P>>T;
    float per= (P*100)/T;
    if(per>=90&&per<=100)
    std::cout << "Very Good" << std::endl;
    else if(per<=89&&per>=80)
    std::cout << "Good" << std::endl;
    else if(per>=75&&per<=79)
    cout<<"Average"<<endl;
    else
    std::cout << "Danger" << std::endl;
}
return 0;

}

Tester's solution

#include <bits/stdc++.h>
using namespace std;

int main(){
int t;
cin >> t;
while(t–){
double NA, NC, res;
cin >> NA >> NC;
res = 100*(NA / NC);
if(res>=90 && res<=100)
cout<< “Very Good\n”;
else if(res>=80 && res<=89)
cout<< “Good\n”;
else if(res>=75 && res<=79)
cout<< “Average\n”;
else
cout<< “Danger\n”;
}
return 0;
}