在bzoj里面刷完到洛谷里刷
查看原帖
在bzoj里面刷完到洛谷里刷
30219
lqzhhh楼主2017/3/9 08:05
#include <iostream>
#define ll long long 
using namespace std;
ll m,n;
ll quickpower(ll x)
{
    if (!x)   return 1;
    ll ls=quickpower(x>>1);
    if (x&1)  return (ls*ls*m)%100003;
        else  return (ls*ls)%100003;
}
int main()
{
    cin>>m>>n;
    m%=100003;
    ll ans=quickpower(n);
    m--;
    ans-=((m+1)*quickpower(n-1))%100003;
    cout<<(ans+100003)%100003<<endl;
    return 0;
}
2017/3/9 08:05
加载中...