QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#279894 | #6300. Best Carry Player 2 | forget-star# | WA | 0ms | 3824kb | C++20 | 886b | 2023-12-09 11:29:16 | 2023-12-09 11:29:17 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
#define fr(i,a,b) for(int i(a),end##i(b);i<=end##i;i++)
#define fd(i,a,b) for(int i(a),end##i(b);i>=end##i;i--)
#define mk make_pair
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back
using namespace std;
int t,x,k;
int p[100],ans[100];
void out(){
int flag=0;
fd(i,50,1){
flag|=(ans[i]!=0);
if(flag)cout<<ans[i];
}
cout<<'\n';
}
signed main(){
#ifdef pig
freopen("pig.in","r",stdin);
freopen("pig.out","w",stdout);
#endif
cin>>t;
while(t--){
scanf("%lld%lld",&x,&k);
fr(i,1,50){
p[i]=x%10;
x/=10;
}
fr(i,1,50)ans[i]=0;
if(k==0){
fr(i,1,50)if(p[i]!=9){
ans[i]=1;
break;
}
out();
continue;
}
fr(i,1,20)if(p[i]&&p[i+k]!=9){
fr(j,i,i+k-1)ans[j]+=9-p[j];
ans[i]++;
out();
break;
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3780kb
input:
4 12345678 0 12345678 5 12345678 18 990099 5
output:
1 54322 999999999987654322 9910
result:
ok 4 lines
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3824kb
input:
21 999990000099999 0 999990000099999 1 999990000099999 2 999990000099999 3 999990000099999 4 999990000099999 5 999990000099999 6 999990000099999 7 999990000099999 8 999990000099999 9 999990000099999 10 999990000099999 11 999990000099999 12 999990000099999 13 999990000099999 14 999990000099999 15 999...
output:
100000 10000 1000 100 10 1 900001 9900001 99900001 999900001 99999000010000000000 9999910000 9999901000 9999900100 9999900010 9999900001 9000009999900001 99000009999900001 999000009999900001 99999999999999999900000000000000000 1000000000000000000
result:
wrong answer 11th lines differ - expected: '10000000001', found: '99999000010000000000'