問題
It's the year
Choose a position
Farmer John gives Bessie a string
Help Bessie count the number of distinct ways for the number line to be colored while satisfying Farmer John's preferences. Two colorings are different if there is at least one corresponding point with a different color. Because the answer may be large, output it modulo
入力
The first line contains an integer
The following line contains string
出力
Output the number of distinct ways for the number line to be colored while satisfying Farmer John's preferences modulo
部分問題
| 番号 | 点数 | 条件 |
|---|---|---|
| #1 | 10点 | |
| #2 | 20点 | |
| #3 | 30点 | All but at most |
| #4 | 40点 | No additional constraints |
例題 #1
6
RXXXXB
5
Bessie can choose
The other colorings are
例題 #2
6
XXRBXX
6
The six colorings are
例題 #3
12
XBXXXXRXRBXX
18