From 4b6a21eb764bbef8ae9cd6606287e3b38d56e1d8 Mon Sep 17 00:00:00 2001 From: ZhuangYumin Date: Tue, 31 Oct 2023 00:07:15 +0800 Subject: [PATCH] upd: first complete version --- src/int2048.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/int2048.cpp b/src/int2048.cpp index bb64e99..f6f21ab 100644 --- a/src/int2048.cpp +++ b/src/int2048.cpp @@ -595,12 +595,17 @@ int2048 operator/(int2048 A, const int2048 &B) { return std::move(A); } -int2048 &int2048::operator%=(const int2048 &) { +int2048 &int2048::operator%=(const int2048 &B) { // 实现复合取模逻辑 + int2048 C=(*this)/B; + *this=*this-C*B; + return *this; } -int2048 operator%(int2048, const int2048 &) { +int2048 operator%(int2048 A, const int2048 &B) { // 实现取模逻辑 + int2048 C=A/B; + return A-C*B; } std::istream &operator>>(std::istream &stream, int2048 &V) {