越狱
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
Description
监狱有连续编号为 到 的 个房间,每个房间关押一个犯人。有 种宗教,每个犯人可能信仰其中一种。如果相邻房间的犯人信仰的宗教相同,就可能发生越狱。求有多少种状态可能发生越狱。
Input Format
输入两个整数 和 。
Output Format
可能越狱的状态数,对 取余。
2 3
6
Hint
【提示】样例说明
所有可能的 6种状态为:$\{0,0,0\},\{0,0,1\},\{0,1,1\},\{1,0,0\},\{1,1,0\},\{1,1,1\}$。
数据范围与提示:对于全部数据, 。
Source
2024吉利学院ACM暑假实践周训练7
- Status
- Done
- Rule
- XCPC
- Problem
- 7
- Start at
- 2024-7-10 13:30
- End at
- 2024-7-10 16:30
- Duration
- 3 hour(s)
- Host
- Partic.
- 26