题目:https://www.luogu.org/problemnew/show/P1965
#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #define ll long long using namespace std; int n,m,k,x,d; int pw(int x,int k) { int ret=1;while(k){if(k&1ll)ret=(ll)ret*x%n;x=(ll)x*x%n;k>>=1ll;}return ret; } int main() { scanf("%d%d%d%d",&n,&m,&k,&x); d=pw(10,k); d=(ll)d*m%n; x=(x+d)%n; printf("%d ",x); return 0; }