#include<bits/stdc++.h>
using namespace std;
int main(){
int T,k;
string x;
cin>>T;
for(int i=0;i<T;i++){
cin>>x>>k;
int cxk[114514],q[114514];
int O_o=x.length();
for(int j=0;j<O_o;j++){
cxk[j]=x[j]-'0';
}
for(int j=0;j<k;j++){
q[j]=10-cxk[j];
if(q[j]==10){
q[j]=0;
k++;
}
if(k>O_o){
cout<<-1;
continue;
}
cout<<q[j];
}
for(int j=k;j<O_o;j++){
cout<<0;
}
cout<<endl;
}
return 0;
}
提交记录传送门
题目