QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#75381 | #5149. Best Carry Player | chris_pher | TL | 0ms | 3564kb | C++23 | 651b | 2023-02-05 03:42:12 | 2023-02-05 03:42:13 |
Judging History
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;
}
詳細信息
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 ...