17 lines
420 B
C++
17 lines
420 B
C++
#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次应该就可以了吧
|
||
*/
|