AC

你加钠了吗  •  9天前


include <bits/stdc++.h>

using namespace std; int n, m, k, x;

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

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

}

int main() {

cin >> n >> m >> k >> x;
cout << (m * quickpow(10, k) % n + x) % n;
return 0;

}


评论:

请先登录,才能进行评论