MCPcopy Create free account
hub / github.com/SuprDewd/CompetitiveProgramming / mod_inv

Function mod_inv

code/mathematics/mod_inv.cpp:2–4  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1#include "egcd.cpp"
2ll mod_inv(ll a, ll m) {
3 ll x, y, d = egcd(a, m, x, y);
4 return d == 1 ? smod(x,m) : -1; }
5// vim: cc=60 ts=2 sts=2 sw=2:

Callers 2

operator /Method · 0.85
testFunction · 0.85

Calls 2

egcdFunction · 0.85
smodFunction · 0.85

Tested by 2

operator /Method · 0.68
testFunction · 0.68