QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#676675#7897. Largest Digitxxk2006WA 1ms3600kbC++231.2kb2024-10-25 23:01:542024-10-25 23:01:54

Judging History

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

  • [2024-10-25 23:01:54]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3600kb
  • [2024-10-25 23:01:54]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define ULL unsigned long long
#define Enter putchar('\n')
#define spc putchar(' ')
#define pb push_back
#define fi first
#define se second
inline void read(int &num){num=0;int f=1;char ch=getchar();while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){num=(num<<1)+(num<<3)+(ch^48);ch=getchar();}num*=f;}
inline void lread(long long &num){num=0;int f=1;char ch=getchar();while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){num=(num<<1)+(num<<3)+(ch^48);ch=getchar();}num*=f;}
void print(long long num){if(num<0){putchar('-');num=-num;}if(num>9){print(num/10);}putchar((num%10)^48);}
int f(int x){
    int d=0;
    while(x){
        d=max(d,x%10);
        x/=10;
    }
    return d;
}
int main(){
    int T,a,b,c,d;
    read(T);
    while(T--){
        read(a),read(b),read(c),read(d);
        if(b-a+1+d-c+1>=10){
            puts("9");
        }
        else{
            int ans=0;
            for(int i=a;i<=b;i++){
                for(int j=c;j<=d;j++){
                    ans=max(ans,f(i+j));
                }
            }
            print(ans),Enter;
        }
    }
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3596kb

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: 3600kb

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
6
9
7
3
5
9
5
9
6
9
9
9
9
9
9
9
9
9
5
9
6
9
9
7
8
9
9
9
9
9
9
3
8
9
7
7
9
9
6
7
9
9
8
9
6
9
9
9
5
9
4
9
5
9
7
9
8
9
9
9
6
9
8
9
5
9
7
9
7
9
9
6
5
9
2
3
6
9
9
8
6
9
9
6
4
9
9
9
9
9
9
8
2
9
4
5
9
9
9
8
6
9
5
7
9
9
9
9
5
9
7
8
5
9
9
9
7
9
9
3
3
9
9
5
7
9
9
6
6
9
7
7
9
9
8
9
9
9
5
9
6
9
7
9
4
9
5
...

result:

wrong answer 59th lines differ - expected: '8', found: '9'