越狱
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
寒假集训_01_09
- Status
- Done
- Rule
- XCPC
- Problem
- 6
- Start at
- 2025-1-9 14:00
- End at
- 2025-1-9 17:00
- Duration
- 3 hour(s)
- Host
- Partic.
- 41