rt,这代码连样例都过不去但能AC
#include<bits/stdc++.h>
using namespace std;
long long a,b,cnt1,cnt2,temp;
int t1[20],t2[20];
void getnum1(long long x){
while(x){
cnt1++;
t1[cnt1]=x%10;
x/=10;
}
}
void getnum2(long long x){
while(x){
cnt2++;
t2[cnt2]=x%10;
x/=10;
}
if(cnt2>6){
for(int i=1;i<=6;i++){
temp+=pow(10,i-1)*t2[i];
}
}
}
int main(){
scanf("%lld%lld",&a,&b);
// printf("%lld",1e12+a-b);
// b%=10000000;
getnum1(a);
getnum2(b);
// cout<<cnt1<<" "<<cnt2<<endl;
if(b<100000000000){
printf("%lld",(long long)1e11+a-b);
return 0;
}
if(cnt2>12){
printf("%lld",b-(long long)999999000000+a);
}
if(cnt2==12){
printf("%lld",min(abs(temp-a),abs(10000000+a-temp)));
}
return 0;
}