版本比较
背诵1
正文
增加 11 行删除 11 行
87 行未改动8889909192929394959696979899991001011021031031041051061071081081091101111121131131141151161161171181191191201211221231241251251261271281298 行未改动13813914014114214214314414514614714814814915015187 行未改动Bint DivMod(Bint A, Bint B, Bint &R){ Bint Q; Q.n = 1; Q.s[0] = '0'; R = A;
if(Compare(A, B) < 0){ return Q; }
Bint base; base.n = 1; base.s[0] = '1';
while(Compare(R, B) >= 0){ Bint tB = B; Bint tBase = base;
while(Compare(R, tB) >= 0){ tB.n++; for(int i=tB.n-1;i>0;i--) tB.s[i] = tB.s[i-1]; tB.s[0] = '0';
tBase.n++; for(int i=tBase.n-1;i>0;i--) tBase.s[i] = tBase.s[i-1]; tBase.s[0] = '0'; }
tB.n--; for(int i=0;i<tB.n;i++) tB.s[i] = tB.s[i+1];
tBase.n--; for(int i=0;i<tBase.n;i++) tBase.s[i] = tBase.s[i+1];
while(Compare(R, tB) >= 0){ R = R - tB; Q = Q + tBase; } }
return Q;}
Bint operator/(Bint A, Bint B){8 行未改动}
int main(){ Bint A = Input(), B = Input();
Output(A + B); cout<<endl; Output(A - B); cout<<endl; Output(A * B); cout<<endl; Output(A / B); cout<<endl; Output(A % B); cout<<endl;
return 0;}```