You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
404 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#include <bits/stdc++.h>
using namespace std;
int n, m, k, x;
int main() {
cin >> n >> m >> k >> x;
double y = pow(10, k);
cout << (x + (int)y * m) % n << endl;
return 0;
}
/*
学习网址https://blog.csdn.net/wwwasdirine/article/details/49430131
每一次让0号位置的小盆友走到m号位置其真正意思是在对应的图上前进m步
因为题目要求从0开始前进m步后直接%n即是当前所处位置
那么跑10^k次应该就可以了吧
*/