1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| #include<bits/stdc++.h> using namespace std; #define ll __int128 #define N 105 void extend_gcd(ll a, ll b, ll &x, ll &y){ if(b == 0){ x = 1, y = 0; return; } extend_gcd(b, a % b, x, y); ll tmp = x; x = y; y = tmp - (a / b) * y; } ll mod_inverse(ll a, ll mod){ ll x, y; extend_gcd(a, mod, x, y); return (x % mod + mod) % mod; } int main(){ cout << (unsigned long long)mod_inverse(e, (p-1)*(q-1));
return 0; }
|