QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#749909 | #5149. Best Carry Player | ckq328 | WA | 20ms | 3704kb | C++20 | 785b | 2024-11-15 11:17:23 | 2024-11-15 11:17:25 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N=1e6+10,M=200+10,inf=1e18,mod=998244353;
int a[N];
int n;
void solve(){
cin>>n;
for(int i=1;i<=n;i++) cin>>a[i];
int ans=0,sum=a[1];
for(int i=2;i<=n;i++){
int tmp1=max(sum,a[i]),tmp2=min(sum,a[i]);
int flag=0;
while(tmp2!=0){
int x=tmp1%10,y=tmp2%10;
tmp1/=10,tmp2/=10;
if(x+y+flag>=10){
ans++,flag=1;
}
}
while(tmp1!=0){
int x=tmp1%10;
tmp1/=10;
if(x+flag>=10){
flag=1;
ans++;
}
else break;
}
}
cout<<ans<<endl;
}
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int tt;
cin>>tt;
// tt=1;
while(tt--){
solve();
}
}
/*
2 1
-1000000000 1000000000
1000000000 1000000000
1 2
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3696kb
input:
2 3 9 99 999 1 12345
output:
5 0
result:
ok 2 number(s): "5 0"
Test #2:
score: 0
Accepted
time: 20ms
memory: 3580kb
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: 12ms
memory: 3704kb
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:
52 40 42 27 56 27 34 52 43 39 8 45 51 43 34 43 38 39 45 42 49 40 42 57 37 47 45 53 36 49 29 43 35 39 35 35 50 34 46 20 43 34 61 50 55 47 47 48 42 42 32 51 32 35 40 41 46 35 38 67 40 38 42 44 44 46 38 48 43 59 30 51 37 52 55 31 53 43 38 38 55 43 29 29 62 44 60 30 34 59 38 41 57 47 29 42 37 49 36 38 4...
result:
wrong answer 1st numbers differ - expected: '42', found: '52'