QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#228729 | #5149. Best Carry Player | whsyhyyh# | WA | 8ms | 3952kb | C++14 | 729b | 2023-10-28 14:04:04 | 2023-10-28 14:04:05 |
Judging History
answer
#include<bits/stdc++.h>
#define N 500010
#define LL long long
#define rep(i,l,r) for(int i=l;i<=r;i++)
using namespace std;
int rd() {
int res=0,f=1;char ch=getchar();
while(ch<'0'||ch>'9') {if(ch=='-') f*=-1;ch=getchar();}
while(ch>='0'&&ch<='9') res=(res<<1)+(res<<3)+(ch^48),ch=getchar();
return res*f;
}
int T,n,a[N];
int gets(int A,int B) {
if(A<B) swap(A,B);
int res=0,up=0;
while(A&&B) {
if((A%10)+(B%10)+up>=10) up=1,res++;
else up=0;
A/=10,B/=10;
}
while(A%10==9&&up) res++,A/=10;
return res;
}
int main() {
T=rd();
while(T--) {
n=rd();
rep(i,1,n) a[i]=rd();
int ans=0;LL now=a[1];
rep(i,2,n) ans+=gets(now,a[i]),now+=a[i];
printf("%d\n",ans);
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3952kb
input:
2 3 9 99 999 1 12345
output:
5 0
result:
ok 2 number(s): "5 0"
Test #2:
score: 0
Accepted
time: 7ms
memory: 3824kb
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: 8ms
memory: 3804kb
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:
20 23 26 18 21 17 25 24 23 33 9 25 19 18 25 22 24 27 17 23 18 20 18 19 18 24 17 33 21 26 19 18 28 22 20 20 33 28 33 22 29 25 24 25 32 30 15 21 17 16 18 33 21 20 25 20 18 28 21 27 13 23 17 25 24 31 27 22 21 32 21 15 21 29 22 22 25 29 19 15 18 24 19 27 25 13 27 20 15 29 16 23 24 25 27 22 27 31 16 21 1...
result:
wrong answer 1st numbers differ - expected: '42', found: '20'