|

General

# Author Problem Lang Verdict Time Memory Sent Judged
265022174 Practice:
chhola_bhatoora
1984B - 36 C++20 (GCC 13-64) Wrong answer on test 2 46 ms 4 KB 2024-06-10 11:10:25 2024-06-10 11:10:25
→ Source
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
int t;
cin>>t;
while(t--){
ll n;
cin>>n;
ll temp=n;
int digits=0;
ll min=0,minupper=6;
ll inc=1;
for(ll i=temp;i>=10;i/=10){
min=min*10+5;
if(i>=100){
minupper=minupper*10;
inc*=10;
}
digits++;
}
// cout<<min<<" "<<minupper<<" "<<digits<<" "<<inc<<endl;
vector<ll> lower(5);
vector<ll> upper(5);
// ll inc=(ll)pow(10,digits-1);
minupper--;
// ll minupper=(ll)6*pow(10,digits-1)-1;
for(int i=0;i<5;i++){
lower[i]=min;
upper[i]=minupper;
min+=inc;
minupper+=inc;
// cout<<lower[i]<<" "<<upper[i]<<endl;

}
int out=0;
for(int i=0;i<5;i++){
for(int j=0;j<5;j++){
ll p=lower[i]+lower[j];
ll q=lower[i]+upper[j];
ll r=upper[i]+lower[j];
ll s=upper[i]+upper[j];
if(n<=q&&n>=p){
out=1;
break;
}
if(n<=s&&n>=r){
out=1;
break;
}
}
if(out==1) break;

}
if(out==1) cout<<"YES"<<endl;
else cout<<"NO"<<endl;

}

return 0;
}
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
?
?
?