We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b8f1b97 commit ee5a871Copy full SHA for ee5a871
cp-algo/number_theory/modint.hpp
@@ -41,7 +41,7 @@ namespace cp_algo::math {
41
}
42
modint_base(): r(0) {}
43
modint_base(int64_t rr): r(rr % mod()) {
44
- r = std::min(r, r + 2 * mod());
+ r = std::min(r, r + mod());
45
r = m_transform(r);
46
47
modint inv() const {
@@ -99,7 +99,7 @@ namespace cp_algo::math {
99
return std::min(res, res - mod());
100
101
void setr_direct(uint64_t rr) {r = rr;}
102
- uint64_t getr_direct() const {return r;}
+ uint64_t getr_direct() const {return std::min(r, r - mod());}
103
private:
104
uint64_t r;
105
modint& to_modint() {return static_cast<modint&>(*this);}
0 commit comments