 # CREDSCORE - Editorial

Setter: Nandeesh Gupta
Tester: Manan Grover
Editorialist: Prakhar Kochar

Cakewalk

None

# PROBLEM:

To access CRED programs, one needs to have a credit score of 750 or more.
Given that the present credit score is X, determine if one can access CRED programs or not.

If it is possible to access CRED programs, output YES, otherwise output NO .

NOTE : You may print each character of the string in uppercase or lowercase (for example, the strings YeS, yEs, yes and YES will all be treated as identical)

# EXPLANATION:

We are given that the present credit score is X. To access CRED programs one needs a credit score of atleast 750. Two cases are possible :

• X \geq 750 ; One can access CRED programs, therefore the output will be YES

• X \lt 750; One can’t access CRED programs, therefore the output will be NO

Examples
• X = 749; Since 749 < 750, output is NO.

• X = 1000; Since 1000 \gt 750, output is YES.

O(1) overall

# SOLUTION:

Tester's Solution
``````#include <bits/stdc++.h>
using namespace std;

long long readInt(long long l, long long r, char endd) {
long long x = 0;
int cnt = 0;
int fi = -1;
bool is_neg = false;
while (true) {
char g = getchar();
if (g == '-') {
assert(fi == -1);
is_neg = true;
continue;
}
if ('0' <= g && g <= '9') {
x *= 10;
x += g - '0';
if (cnt == 0) {
fi = g - '0';
}
cnt++;
assert(fi != 0 || cnt == 1);
assert(fi != 0 || is_neg == false);

assert(!(cnt > 19 || (cnt == 19 && fi > 1)));
}
else if (g == endd) {
assert(cnt > 0);
if (is_neg) {
x = -x;
}
assert(l <= x && x <= r);
return x;
}
else {
assert(false);
}
}
}
int main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int x;
if(x >= 750){
cout<<"YES\n";
}else{
cout<<"NO\n";
}
return 0;
}
``````
Editorialist's Solution
``````#include <bits/stdc++.h>
using namespace std;

#define int long long int
#define inf INT_MAX
#define mod 998244353

void f() {
int x; cin >> x;
if (x >= 750) cout << "YES\n";
else cout << "NO\n";
}

int32_t main() {
ios::sync_with_stdio(0); cin.tie(0);
int t = 1;
while (t--) f();
}
``````
4 Likes