QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#314972#7897. Largest DigithyjswsWA 3ms3672kbC++14586b2024-01-26 16:00:052024-01-26 16:00:06

Judging History

你现在查看的是最新测评结果

  • [2024-01-26 16:00:06]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:3672kb
  • [2024-01-26 16:00:05]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=1000010;
typedef long long LL;
LL a,b,c,d,n,m,idx,ans,e[N],ne[N],h[N],l1,l2,r1,r2,x1,x2,y3,y2;
void init(LL u)
{
    while(u)
    {
        ans=max(ans,u%10);
        u/=10;
    }
}
void solve()
{
    cin>>a>>b>>c>>d;
    if(b+d-a-c>=10)
    {
        cout<<9<<endl;
    }
    else
    {
        for(LL i=a+c;i<=b+d;i++)
        {
            init(i);
        }
        cout<<ans<<endl;
    }
}
int main()
{
    LL N=1;
    cin>>N;
    while(N--)
    {
        solve();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3672kb

input:

2
178 182 83 85
2 5 3 6

output:

7
9

result:

ok 2 lines

Test #2:

score: -100
Wrong Answer
time: 3ms
memory: 3608kb

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:

9
7
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
...

result:

wrong answer 4th lines differ - expected: '6', found: '9'