Skip to content

Commit 69cff1e

Browse files
authored
Merge pull request #58 from suisen-cp/master
ModInt: fix #57
2 parents 022f4fc + 3f525b5 commit 69cff1e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

ModInt/ModInt.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
/**
22
* @verified
33
* <ul>
4-
* <li> https://atcoder.jp/contests/arc050/tasks/arc050_c </li>
5-
* <li> https://atcoder.jp/contests/abc129/tasks/abc129_f </li>
6-
* <li> https://atcoder.jp/contests/arc012/tasks/arc012_4 </li>
4+
* <li> https://atcoder.jp/contests/m-solutions2019/tasks/m_solutions2019_c : (M = 1000000007)
5+
* <li> https://atcoder.jp/contests/abc172/tasks/abc172_e : (M = 1000000007)
6+
* <li> https://atcoder.jp/contests/abc129/tasks/abc129_f : (2 <= M <= 1000000000)
7+
* <li> https://atcoder.jp/contests/arc050/tasks/arc050_c : (2 <= M <= 1000000000)
8+
* <li> https://atcoder.jp/contests/arc012/tasks/arc012_4 : (1 <= M <= 1000000007)
79
* </ul>
810
*/
911
class ModIntFactory {
@@ -192,6 +194,7 @@ int div(int a, int b) {
192194
}
193195
int inv(int a) {
194196
int b = mod();
197+
if (b == 1) return 0;
195198
long u = 1, v = 0;
196199
while (b >= 1) {
197200
int t = a / b;

0 commit comments

Comments
 (0)