Files
python/C++课程/第十五课循环结构程序设计实例/p166_2.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

17 lines
420 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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次应该就可以了吧
*/