From e80d6a6b75dbe73fbe5b4c2b37e2a16c2e0b71fc Mon Sep 17 00:00:00 2001 From: Kyungmo Ku <46951576+Pentagon03@users.noreply.github.com> Date: Fri, 2 Aug 2024 22:03:35 +0900 Subject: [PATCH] Update ext_gcd&inv.cpp --- Math/ext_gcd&inv.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Math/ext_gcd&inv.cpp b/Math/ext_gcd&inv.cpp index af683de..64cf860 100644 --- a/Math/ext_gcd&inv.cpp +++ b/Math/ext_gcd&inv.cpp @@ -19,6 +19,7 @@ ll inv(ll a, ll m){ if(g != 1) return -1; return (x%m + m) % m; } +// inv(i) = inv(p % i) * (-p / i) // do_smth for x,y that ax + by = s, x >= 0 && y >= 0 bool do_smth(ll a, ll b, ll s){ @@ -34,4 +35,4 @@ bool do_smth(ll a, ll b, ll s){ } } return true; -} \ No newline at end of file +}