QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#727382#5149. Best Carry Playeryixuanoct#WA 63ms4076kbC++20664b2024-11-09 13:02:222024-11-09 13:02:23

Judging History

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

  • [2024-11-09 13:02:23]
  • 评测
  • 测评结果:WA
  • 用时:63ms
  • 内存:4076kb
  • [2024-11-09 13:02:22]
  • 提交

answer

#include <bits/stdc++.h>
int arr[20];
void solve() {
    int n;
    scanf("%d", &n);
    memset(arr, 0, sizeof(arr));
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        std::string s;
        std::cin >> s;
        for (int j = s.length() - 1; j >= 0; j--) {
            arr[j] = arr[j] + s[j] - '0';
        }
        for (int j = 0; j < 20;j++) {
            while (arr[j] >= 10) {
                arr[j + 1]++;
                arr[j] -= 10;
                ans++;
            }
        }
    }
    printf("%d\n", ans);
}
int main() {
    int _;
    scanf("%d", &_);
    while (_--) {
        solve();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
3
9 99 999
1
12345

output:

5
0

result:

ok 2 number(s): "5 0"

Test #2:

score: 0
Accepted
time: 63ms
memory: 4072kb

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: 16ms
memory: 3736kb

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:

40
40
40
35
44
34
45
39
37
42
31
42
43
37
38
40
39
40
37
41
38
41
38
42
39
38
38
44
36
42
38
40
41
40
38
34
47
40
43
36
42
42
46
40
36
41
37
42
39
36
37
44
39
43
39
41
43
37
35
43
37
38
39
41
44
45
42
43
39
43
37
41
39
43
41
40
42
41
42
39
37
41
35
42
41
40
43
36
37
43
40
35
37
42
41
42
44
43
31
38
...

result:

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