QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#216051 | #5149. Best Carry Player | jason# | WA | 1ms | 3440kb | C++14 | 959b | 2023-10-15 15:26:37 | 2023-10-15 15:26:38 |
Judging History
answer
#include<bits/stdc++.h>
#define pii pair<int,int>
#define x first
#define y second
#define int long long
using namespace std;
const int N=2e5+5;
int a[N];
void slove(){
int n,s,res=0,ans,tmp;cin>>n;
// cin>>s;
for(int i = 1; i <= n; i++)
cin >> a[i];
sort(a + 1, a + 1 + n);
s = a[n];
for(int i=n-1,x;i>=1;--i){
x = a[i];
// cin>>x;
tmp = ans=s+x;
bool f1=1,f2=1;
while(tmp){
int a=tmp%10,b=s%10,c=x%10,flag=0;
if(s==0)f1=0;
if(x==0)f2=0;
if(f1&&a<b){
flag=1;
}
if(f2&&a<c){
flag=1;
}
if(flag) ++res;
tmp/=10,s/=10,x/=10;
}
s = ans;
}
cout<<res<<"\n";
}
signed main()
{
ios::sync_with_stdio(0);
int t;cin>>t;
while(t--){
slove();
}
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3440kb
input:
2 3 9 99 999 1 12345
output:
4 0
result:
wrong answer 1st numbers differ - expected: '5', found: '4'