hack
查看原帖
hack
808180
HDS_Acenaphthylene楼主2023/12/1 14:13
#include <bits/stdc++.h>
#define int long long
int mod;
using namespace std;
int qpow(int a, int x) {
	if (x == 0)
		return 1;
	int t = qpow(a, x >> 1);
	return ((t * t) % mod * (x & 1 ? a : 1)) % mod;
}
signed main() {
	//	freopen("copycat.in", "r", stdin);
	//	freopen("copycat.out", "w", stdout);
	int t, a;
	cin >> a >> t >> mod;
	printf("%lld^%lld mod %lld=%lld", a, t, mod, qpow(a, t)
		);
	return 0;
}

114 0 1

正确输出:0 以上程序输出:1

2023/12/1 14:13
加载中...