QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#655902 | #5149. Best Carry Player | wzxtsl# | WA | 36ms | 3680kb | C++23 | 915b | 2024-10-19 10:15:30 | 2024-10-19 10:15:31 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define int long long
const int N=2e6+7;
int n,m;
int bronya[18];
int ans=0;
int pluss(int a,int b){
int sum=0;
int pro=0;
int la=0,lb=0;
int aa=a,bb=b;
while(aa){la++,aa/=10;}
while(bb){lb++,bb/=10;}
for(int i=0;i<max(la,lb);i++){
int x=a/bronya[i]%10;
int y=b/bronya[i]%10;
if(x+y+pro>=10)sum++,pro=(x+y+pro)%10;
}
return sum;
}
void solve(){
cin>>n;
int su=0;
cin>>su;
for(int i=2;i<=n;i++){
int bu;cin>>bu;
ans+=pluss(su,bu);
su+=bu;
}
cout<<ans<<endl;
}
signed main(){
fast;
int ps=1;
for(int i=0;i<=16;i++){
bronya[i]=ps;
ps*=10;
}
int t=1;
cin>>t;
while(t--){
solve();
ans=0;
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3680kb
input:
2 3 9 99 999 1 12345
output:
5 0
result:
ok 2 number(s): "5 0"
Test #2:
score: 0
Accepted
time: 36ms
memory: 3564kb
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: 21ms
memory: 3564kb
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:
49 53 56 47 55 38 50 52 45 58 42 50 54 57 54 49 54 44 49 48 46 55 49 58 47 57 45 56 49 50 42 45 55 51 52 47 61 40 55 44 59 59 54 55 38 51 53 51 55 47 45 57 52 59 47 50 51 42 50 59 51 50 44 53 59 52 50 56 54 52 50 52 45 58 52 52 45 53 50 53 48 54 45 56 52 48 54 48 52 56 50 44 47 50 50 53 50 53 41 48 ...
result:
wrong answer 1st numbers differ - expected: '42', found: '49'