| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 4 초 | 2048 MB | 5 | 4 | 4 | 80.000% |
Donald is the curator of a museum specializing in medieval artifacts. He is especially proud of a recently acquired triptych (a three-paneled work of art) that is filled with religious iconography. He wants to make this triptych the main attraction in the museum's next exhibit, and he plans to highlight one of the three panels during each week of the exhibit by shining a special spotlight on it.
As an intern in the museum's IT department, your primary task is to program the microcontroller that operates the spotlight. For simplicity, the three panels are labelled A, B, C, from left to right, and the input to the microcontroller will be a string of these characters, specifying, in order, the panel that is to be highlighted during each week of the exhibit (which may run as long as a year). Such a string is called a spotlight sequence.
In addition to programming the microcontroller, Donald has asked you to generate some possible spotlight sequences, from which he will pick one. However, not every sequence of characters from $\{ \textrm{A}, \textrm{B}, \textrm{C} \}$ is acceptable, since Donald is very strict about the following rules:
Given the number of weeks of the exhibit, and the value of $d$, determine the total number of spotlight sequences you can generate for Donald to choose from.
The input consists of a line containing two integers, $w$ $(2 \leq w \leq 52)$ and $d$ $(0 \leq d \leq 10),$ the number of weeks of the exhibit and the "maximum difference" value described above, respectively.
Output a single integer: the total number of spotlight sequences of $\textrm{length } w$ you can generate that comply with all of Donald's rules.
3 0
6
2 0
0
4 1
24
ICPC > Regionals > North America > East Central North America Regional > 2025 East Central NA Regional Contest K번