AC

元素周期表第51位  •  10天前


include

include

using namespace std; int p;

long long quickpow(long long x, long long y) {

long long ans = 1;
while (y) {
	if (y & 1)
		ans = ans * x % p;
	x = x * x % p;
	y >>= 1;
}
return ans;

}

int main() {

int n;
cin >> n >> p;
cout << quickpow(n, p - 2);
return 0;

}


评论:

请先登录,才能进行评论