提交时间:2023-10-12 13:24:36

运行 ID: 106502

#include<bits/stdc++.h> using namespace std; int x,y; int i,j; char ab[100001],bc[100001]; int a[100001],b[100001]; int jw; int maxn,maxj; int main(){ cin>>ab>>bc; x=strlen(ab); y=strlen(bc); for(i=0;i<x;i++) a[i]=ab[x-i-1]-'0'; for(i=0;i<y;i++) b[i]=bc[y-i-1]-'0'; maxn=max(x,y); for(i=0;i<maxn;i++){ a[i]=a[i]-b[i]+jw; jw=a[i]/10; a[i]%=10; } if(jw==1) cout<<jw; int flag = 0; for(i=maxn-1;i>=0;i--){ if(flag == 0 && a[i] ==0 ){ continue; } cout<<a[i]; flag++; } return 0; }