QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#612677 | #7897. Largest Digit | wzxtsl# | WA | 1ms | 3624kb | C++23 | 640b | 2024-10-05 12:32:09 | 2024-10-05 12:32:10 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define int long long
int n,m;
int la,lb,ra,rb;
const int N=2e6+7;
const int mod=998244353;
int a[N];
void solve(){
cin>>la>>ra>>lb>>rb;
int a=la+lb,b=ra+rb;
if(b>=a+10)
{
cout<<9;return;
}
int maxn=0;
for(int i=a;i<=b;i++)
{
int tp=i;
while(tp)
{
maxn=max(maxn,tp%10);
tp/=10;
}
}
cout<<maxn<<endl;
}
signed main(){
fast;
int t=1;
cin>>t;
while(t--){
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3624kb
input:
2 178 182 83 85 2 5 3 6
output:
7 9
result:
ok 2 lines
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 3588kb
input:
1000 158260522 877914575 24979445 602436426 1 5 1101111 1101112 2 5 33333 33335 1 5 10111 10111 138996221 797829355 353195922 501899080 212 215 10302 10302 101100 101101 1 2 111 114 1101000 1101001 265804420 569328197 234828607 807497925 1110110 1110112 11100 11103 323 327 23 27 1 1 1 5 316412581 80...
output:
97 9 6 97 3 5 95 9 6 99 9 9 99 99 95 96 99 7 8 99 99 99 3 8 97 7 9 96 7 9 98 9 6 99 9 5 94 9 5 97 8 8 99 9 6 98 9 5 97 97 99 6 5 92 3 6 99 8 6 99 6 4 99 9 9 99 8 2 94 5 999 8 6 95 7 9 99 9 5 97 8 5 99 9 7 99 3 3 99 5 7 996 6 97 7 998 9 9 95 9 6 97 9 4 95 8 8 97 2 8 99 6 8 99 99998 9 97 7 6 97 9 9 94...
result:
wrong answer 1st lines differ - expected: '9', found: '97'