数据过水
  • 板块P9390 金盏花
  • 楼主rechenz
  • 当前回复0
  • 已保存回复0
  • 发布时间2023/6/6 13:25
  • 上次更新2023/10/23 13:50:44
查看原帖
数据过水
816281
rechenz楼主2023/6/6 13:25

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;
}
2023/6/6 13:25
加载中...