QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#412331#5149. Best Carry Playerhuangbrother#WA 47ms3652kbC++17572b2024-05-16 11:58:322024-05-16 11:58:33

Judging History

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

  • [2024-05-16 11:58:33]
  • 评测
  • 测评结果:WA
  • 用时:47ms
  • 内存:3652kb
  • [2024-05-16 11:58:32]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int a[100010];
int main(){
    int t;
    cin>>t;
    while(t--){
        int n,ans=0;
        cin>>n;
        for(int i=1;i<=n;i++)cin>>a[i];
        sort(a+1,a+n+1);
        for(int i=2;i<=n;i++){
            int m1=a[i-1],m2=a[i];
            int carry=0,res=0;
            while(m1||m2){
                int res=m1%10+m2%10+carry;
                if(res>=10)carry=1,ans++;
                else carry=0;
                m1/=10,m2/=10;
            }
        }
        cout<<ans<<endl;
        
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
3
9 99 999
1
12345

output:

5
0

result:

ok 2 number(s): "5 0"

Test #2:

score: 0
Accepted
time: 47ms
memory: 3652kb

input:

100000
1
481199252
1
634074578
1
740396295
1
579721198
1
503722503
1
202647942
1
268792718
1
443917727
1
125908043
1
717268783
1
150414369
1
519096230
1
856168102
1
674936674
1
274667941
1
527268921
1
421436316
1
286802932
1
646837311
1
451394766
1
105650419
1
302790137
1
254786900
1
76141081
1
7393...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 numbers

Test #3:

score: -100
Wrong Answer
time: 28ms
memory: 3600kb

input:

10000
10
598196518 640274071 983359971 71550121 96204862 799843967 446173607 796619138 402690754 223219513
10
312183499 905549873 673542337 566661387 879397647 434495917 631413076 150918417 579868000 224422012
10
525305826 535526356 404334728 653535984 998133227 879226371 59632864 356493387 62611196...

output:

41
43
43
33
39
23
49
39
39
45
29
44
49
43
35
41
45
39
34
43
36
42
37
42
38
33
36
50
32
39
36
49
40
44
42
29
55
40
43
26
46
43
47
38
36
44
37
45
41
35
35
56
38
45
39
45
42
32
36
45
39
38
39
42
44
50
39
40
34
41
34
46
37
45
37
41
39
44
45
36
36
42
29
45
41
40
54
30
40
52
41
32
31
38
47
41
45
51
30
39
...

result:

wrong answer 1st numbers differ - expected: '42', found: '41'