QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#75381#5149. Best Carry Playerchris_pherTL 0ms3564kbC++23651b2023-02-05 03:42:122023-02-05 03:42:13

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-02-05 03:42:13]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:3564kb
  • [2023-02-05 03:42:12]
  • 提交

answer

#include <bits/stdc++.h> 
typedef long long ll;
using namespace std;
#define int ll
const int N = 100010;
int a[N];

inline void solve()
{
	int n; cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}

	int sum = a[0], ans = 0;
	for (int i = 1; i < n; ++i) {
		int t = sum + a[i];
		int tmp = 0;
		while (sum or a[i]) {
			tmp = sum % 10 + a[i] % 10 + tmp;
			sum /= 10, a[i] /= 10;
			if (to_string(tmp).size() > 1) ++ans;
			tmp /= 10;
		}
		sum = t;
	}
	cout << ans << endl;
}
signed main()
{
	std::ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
	int T = 1; cin >> T;
	while (T--) solve();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
3
9 99 999
1
12345

output:

5
0

result:

ok 2 number(s): "5 0"

Test #2:

score: -100
Time Limit Exceeded

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: