BOANY
Home
ProblemSet
Source/Category
Contest
Status
Ranklist
F.A.Qs
历年真题
推荐题单
Login
Register
1146: [HNOI2008]越狱
Memory Limit:128 MB
Time Limit:1.000 S
Judge Style:Text Compare
Creator:
Submit:39
Solved:9
Submit
Submit Record
Statistics
ShowOff!
Description
监狱有连续编号为1…N的N个房间,每个房间关押一个犯人,有M种宗教,每个犯人可能信仰其中一种。如果相邻房间的犯人的宗教相同,就可能发生越狱,求有多少种状态可能发生越狱
Input
输入两个整数M,N.1<=M<=10
8
,1<=N<=10
12
Output
可能越狱的状态数,模100003取余
Sample Input
Copy
2 3
Sample Output
Copy
6
HINT
6种状态为(000)(001)(011)(100)(110)(111)
视频讲解
Source/Category
HNOI2008
快速幂
Submit
Submit Record
Statistics
ShowOff!