PROBLEM LINK:
Contest Division 1
Contest Division 2
Contest Division 3
Contest Division 4
Setter: Kanhaiya Mohan
Tester: Harris Leung
Editorialist: Aman Dwivedi
DIFFICULTY:
Cakewalk
PREREQUISITES:
None
PROBLEM:
The chef’s phone shows a Battery Low notification if the battery level is 15\% or less.
Given that the battery level of Chef’s phone is X\%, determine whether it would show a Battery low notification.
EXPLANATION:
if the battery percentage is greater than 15\%, you can simply print NO as it won’t give any notification. Otherwise, it would give a notification and hence print YES
TIME COMPLEXITY:
O(1) per test case
SOLUTIONS:
Author's
#include <iostream>
using namespace std;
int main() {
int t;
cin>>t;
while(t--){
int n;
cin>>n;
if(n <= 15) cout<<"yEs";
else cout<<"NO";
cout<<endl;
}
return 0;
}
Tester's
Editorialist
#include<bits/stdc++.h>
using namespace std;
void solve()
{
int x;
cin>>x;
cout<<((x>15)?"NO":"YES")<<"\n";
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int t;
cin>>t;
while(t--)
solve();
return 0;
}
}