CREDITS - Editorial

PROBLEM LINK:

Contest Division 1
Contest Division 2
Contest Division 3
Contest Division 4

Setter: Utkarsh Gupta
Tester: Harris Leung
Editorialist: Kanhaiya Mohan

DIFFICULTY:

Cakewalk

PREREQUISITES:

None

PROBLEM:

In Uttu’s college, a semester is said to be a:

  • Overload semester if the number of credits taken >65.
  • Underload semester if the number of credits taken < 35.
  • Normal semester otherwise.

Given the number of credits X taken by Uttu, determine whether the semester is Overload, Underload or Normal.

EXPLANATION:

In this problem, we just need to implement the problem statement. The focus is on our ability to translate the problem statement into functioning error-free code.

We can use if-else statements for the same. For the given value of X, check:

  • If X>65, print Overload.
  • Else if, X<35, print Underload.
  • Else, print Normal.

TIME COMPLEXITY:

The time complexity is O(1) per test case.

SOLUTION:

Tester's Solution
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
const ll mod=998244353;
int t;
int n,m;
ll a[300001];
ll s=0;
int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    int t;cin >> t;
    while(t--){
    	int x;
    	cin >> x;
    	if(x>65) cout << "Overload\n";
    	else if(x<35) cout << "Underload\n";
    	else cout << "Normal\n";
	}
}
Editorialist's Solution
#include <iostream>
using namespace std;

int main() {
	int t;
	cin>>t;
	while(t--){
	    int x;
	    cin>>x;
	    if(x>65){
	        cout<<"Overload";
	    }
	    else if(x<35){
	        cout<<"Underload";
	    }
	    else{
	        cout<<"Normal";
	    }
	    cout<<endl;
	}
	return 0;
}