QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#690116 | #5149. Best Carry Player | IsacBieber# | WA | 18ms | 3736kb | C++23 | 1.3kb | 2024-10-30 20:21:43 | 2024-10-30 20:21:45 |
Judging History
answer
#include <bits/stdc++.h>
// #include<bits/extc++.h>
#define endl '\n'
#define eps 1e-7
#define pb push_back
#define eb emplace_back
#define debug(x) cerr<<#x<<": "<<x<<'\n';
// using namespace __gnu_pbds;
using namespace std;
using ll = long long;
using ld = long double;
using pll = pair <ll,ll>;
using pii = pair <int,int>;
using ull = unsigned long long;
const int N = 1e6 + 5, M = 50, MOD = 1e9 + 7;
mt19937_64 rnd (chrono::steady_clock::now().time_since_epoch().count());
int n, ans, a[N], cal[M], tmp[M];
void isac()
{
cin>>n;
for(int i=1;i<=n;i++) cin>>a[i];
sort(a+1,a+n+1);
for(int i=1;i<=20;i++) cal[i] = 0;
ans = 0;
for(int i=1;i<=n;i++)
{
int len = 0;
int x = a[i];
while(x)
{
tmp[++len] = x%10;
x /= 10;
}
int carry = 0;
for(int j=1;j<=20;j++)
{
int s = tmp[j] + cal[j] + carry;
cal[j] = s%10;
carry = s/10;
if(carry) ans ++;
}
}
cout<<ans<<'\n';
}
int main(void)
{
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
int T = 1;
cin >> T;
while (T--) isac();
return 0;
}
/*
Zena youth together.
Such a pretty name.
There will be a long story.
Time will tell all.
*/
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3652kb
input:
2 3 9 99 999 1 12345
output:
5 0
result:
ok 2 number(s): "5 0"
Test #2:
score: 0
Accepted
time: 18ms
memory: 3736kb
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: 3628kb
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:
42 41 44 35 43 36 46 38 40 46 31 44 45 39 39 43 41 40 38 42 38 42 41 42 42 40 40 45 38 44 39 42 41 42 42 35 50 39 43 33 47 43 46 42 38 44 40 41 42 38 35 44 40 44 40 41 42 36 36 45 37 39 40 41 43 47 41 43 40 44 40 43 38 43 41 40 42 44 43 40 38 41 37 43 41 41 44 35 38 44 41 36 36 43 41 41 45 45 32 38 ...
result:
wrong answer 3rd numbers differ - expected: '42', found: '44'