Skip to content

Commit ee5a871

Browse files
committed
Fix
1 parent b8f1b97 commit ee5a871

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cp-algo/number_theory/modint.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ namespace cp_algo::math {
4141
}
4242
modint_base(): r(0) {}
4343
modint_base(int64_t rr): r(rr % mod()) {
44-
r = std::min(r, r + 2 * mod());
44+
r = std::min(r, r + mod());
4545
r = m_transform(r);
4646
}
4747
modint inv() const {
@@ -99,7 +99,7 @@ namespace cp_algo::math {
9999
return std::min(res, res - mod());
100100
}
101101
void setr_direct(uint64_t rr) {r = rr;}
102-
uint64_t getr_direct() const {return r;}
102+
uint64_t getr_direct() const {return std::min(r, r - mod());}
103103
private:
104104
uint64_t r;
105105
modint& to_modint() {return static_cast<modint&>(*this);}

0 commit comments

Comments
 (0)