F.A.Qs Home ProblemSet Status Ranklist Contest LoginRegister
Notice:1:注册本OJ方式请见https://www.lydsy.com/JudgeOnline/wttl/thread.php?tid=5671 2:请不要在讨论区中发空白主题帖。
大视野在线测评-欢迎您
[ New Thread ]
Problem 1008 >> 搞半天是%lld....染色问题吧
xiang556 @ 2018-07-13 02:37:14
[ Quote ] [ Edit ] [ Delete ] 1#
搞半天是%lld....染色问题吧

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <iostream>
#include <algorithm>
#include <ctype.h>
#include <set>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <limits.h>
#define left (now<<1)
#define right ((now<<1)+1)
#define mid ((l+r)>>1)
#define fst first
#define snd second
#define sfn scanf("%d",&n)
#define sfnm scanf("%d%d",&n,&m)
#define sft scanf("%d",&t)
#define pfans printf("%d\n",ans)
using namespace std;
typedef long long lint;

const int MAXN = 3e5 + 10;
const int MOD = 100003;

lint quickPow(lint n,lint m){
lint re = 1; n %= MOD;
while(m != 0){
if((m & 1) == 1){re *= n; re %= MOD;}
n *= n; n %= MOD; m = m >> 1;
}
return re % MOD;
}

int main(){
lint n,m,a,b;
while(scanf("%lld%lld",&m,&n) != EOF){
a = quickPow(m,n) % MOD;
b = (m % MOD) * quickPow(m - 1,n - 1); b %= MOD;
lint ans = a - b;
if(ans < 0){
ans += MOD;
}
printf("%lld\n",ans);
}
return 0;
}
[Top] [Previous Page] [Next Page]

HOME Back