打高精除高精模板时,运行出错,求助大佬qaq
  • 板块学术版
  • 楼主alltoowell13
  • 当前回复3
  • 已保存回复3
  • 发布时间2021/4/12 22:30
  • 上次更新2023/11/5 00:36:51
查看原帖
打高精除高精模板时,运行出错,求助大佬qaq
294894
alltoowell13楼主2021/4/12 22:30
#include<bits/stdc++.h>
using namespace std;
string x,y;
int a[100010],b[100010],c[100010],sub[100010],xa,xb,xc,xs,con;
int main(){
    cin>>x>>y;
    xa=x.length(),xb=y.length();
    xc=xa-xb+1;
    for(int i=0;i<xa;i++) a[xa-i]=x[i]-'0';
    for(int i=0;i<xb;i++) b[xb-i]=y[i]-'0';
    for(int i=xc;i>=1;i--){
        for(int j=1;j<=xb;i++) sub[j+i-1]=b[j];
        xs=xb+i-1;
        if(xa>xs) con=1;
        else if(xa<xs) con=-1;
        else{
            for(int i=xa;i>=1;i--){
                if(a[i]>sub[i]) con=1;
                if(a[i]<sub[i]) con=-1;
            }
        }
        while(con>=0){
            c[i]++;
            for(int i=1;i<=xa;i++){
                if(a[i]<b[i]){
                    a[i]+=10;
                    a[i+1]--;
                }
                a[i]-=sub[i];
            }
            while(a[xa]==0&&xa>1) xa--;
        }
    }
    while(c[xc]==0&&xc>1) xc--;
    for(int i=xc;i>=1;i--) cout<<c[i];
    /*for(int i=xa;i>=1;i--) cout<<a[i];
      输出余数*/
}

运行错误

2021/4/12 22:30
加载中...