QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#655928 | #5149. Best Carry Player | wzxtsl# | WA | 32ms | 3716kb | C++23 | 894b | 2024-10-19 10:23:49 | 2024-10-19 10:23:50 |
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=1;
}
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;
}
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3716kb
input:
2 3 9 99 999 1 12345
output:
5 0
result:
ok 2 number(s): "5 0"
Test #2:
score: 0
Accepted
time: 32ms
memory: 3708kb
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: 11ms
memory: 3644kb
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:
44 41 46 39 46 37 45 40 41 48 35 43 43 41 40 41 42 44 42 42 40 42 40 43 43 41 41 47 40 46 40 40 42 43 42 37 52 40 43 38 46 45 46 44 36 45 41 43 43 42 35 49 43 47 39 40 42 39 38 50 38 42 42 46 47 44 43 44 43 46 39 45 39 45 42 42 44 44 42 46 41 46 37 46 43 42 46 39 40 45 41 41 39 45 41 42 48 47 33 41 ...
result:
wrong answer 1st numbers differ - expected: '42', found: '44'