您的位置:首页 > 其它

noip2013转圈游戏

2017-10-31 21:47 323 查看
#include<iostream>

#include<cstdio>

#include<cstring>

#include<algorithm>

#include<cmath>

using namespace std;

int n,m,k,x;

int p(int x,int y,int z){

    if(y==0) return 1;

    if(y==1) return x;

    int res=p(x,y/2,z);

    res=res%z*res%z;

    if(y&1) res=res%z*x%z;  

    return res;  

}

int main(){

    ios::sync_with_stdio(false);

    cin>>n>>m>>k>>x;

    int now=p(10,k,n);

    int ans=(x+m%n*now%n)%n;

    cout<<ans<<endl;

    return 0;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: