Exgcd 模板
Exgcd 模板
pair<int, int> exgcd(int a, int b) {
if (b == 0)return make_pair(1, 0);
auto [x, y] = exgcd(b, a % b);
pair<int, int> ans = make_pair(y, x - a / b * y);
return ans;
}
pair<int, int> exgcd(int a, int b) {
if (b == 0)return make_pair(1, 0);
auto [x, y] = exgcd(b, a % b);
pair<int, int> ans = make_pair(y, x - a / b * y);
return ans;
}