Skip to content

Commit 42ebc02

Browse files
author
atcoder-live
committed
fix mint, comb
1 parent fe4955a commit 42ebc02

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

comb.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
struct combination {
55
vector<mint> fact, ifact;
66
combination(int n):fact(n+1),ifact(n+1) {
7+
assert(n < mod);
78
fact[0] = 1;
89
for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
910
ifact[n] = fact[n].inv();

mint.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
const int mod = 1000000007;
66
struct mint {
77
ll x; // typedef long long ll;
8-
mint(ll x=0):x(x%mod){}
8+
mint(ll x=0):x((x%mod+mod)%mod){}
99
mint& operator+=(const mint a) {
1010
if ((x += a.x) >= mod) x -= mod;
1111
return *this;

0 commit comments

Comments
 (0)