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 fe4955a commit 42ebc02Copy full SHA for 42ebc02
comb.cpp
@@ -4,6 +4,7 @@
4
struct combination {
5
vector<mint> fact, ifact;
6
combination(int n):fact(n+1),ifact(n+1) {
7
+ assert(n < mod);
8
fact[0] = 1;
9
for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
10
ifact[n] = fact[n].inv();
mint.cpp
@@ -5,7 +5,7 @@
const int mod = 1000000007;
struct mint {
ll x; // typedef long long ll;
- mint(ll x=0):x(x%mod){}
+ mint(ll x=0):x((x%mod+mod)%mod){}
mint& operator+=(const mint a) {
if ((x += a.x) >= mod) x -= mod;
11
return *this;
0 commit comments