QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#277451 | #5149. Best Carry Player | zzuqy# | WA | 0ms | 3664kb | C++14 | 954b | 2023-12-06 19:06:12 | 2023-12-06 19:06:12 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
#define db double
#define endl '\n'
#define rep(x,y,z) for(int x=y;x<=z;++x)
#define fep(x,y,z) for(int x=y;x>=z;--x)
using namespace std;
const int N=1e5+10;
int T,n,a[N],b[N],c[N][20],m[N];
inline void run()
{
cin>>n;
rep(i,1,n) cin>>a[i];
rep(i,1,n)
{
int x=a[i];m[i]=0;
while(x)
{
c[i][++m[i]]=x%10;
x/=10;
}
}
int M=m[1],ans=0;
rep(i,1,20) b[i]=c[1][i];
rep(i,2,n)
{
int now=0;
rep(j,1,m[i])
{
b[j]+=c[i][j]+now;
if(b[j]>=10)
{
ans++;
now=b[j]/10;
b[j]%=10;
}
}
rep(j,m[i]+1,M)
{
b[j]+=now;
if(b[j]>=10)
{
ans++;
now=b[j]/10;
b[j]%=10;
}
}
if(now)
{
b[++M]=now;
ans++;
}
}
cout<<ans<<endl;
}
int main()
{
// freopen("1.in","r",stdin);
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
cin>>T;
while(T--) run();
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3664kb
input:
2 3 9 99 999 1 12345
output:
7 0
result:
wrong answer 1st numbers differ - expected: '5', found: '7'