版本比较
背诵1
正文
增加 11 行删除 11 行
87 行未改动8889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281298 行未改动13813914014114214314414514614714814915015187 行未改动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;}```87 行未改动8889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281298 行未改动13813914014114214314414514614714814915015187 行未改动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;}```