思路:
简单的数学题。
#include<cstdio> #include<iostream> using namespace std; long long quickpow(long long a, long long b, long long p){ long long res = 1; while(b){ if(b & 1) res = res * a % p; a = a * a % p; b >>= 1; } return res; } long long n, m, k, x; int main(void){ cin >> n >> m >> k >> x; cout << (x + ((m % n) * quickpow(10, k, n)) % n) % n << endl; }
原文地址:https://www.cnblogs.com/junk-yao-blog/p/9505513.html
时间: 2024-11-09 05:12:07