Moo Decomposition
- 시간 제한
- 2s
- 메모리 제한
- 1024MB
- 제출
- 0
- 정답
- 0
- 맞힌 사람
- 0
- 정답 비율
- 0.0%
문제
You have a long string of Ms and Os and an integer . Count the number of ways of ways to decompose into subsequences such that each subsequence is MOOOO....O with exactly Os, modulo .
Since the string is very long, you are not given it explicitly. Instead, you are given an integer (), and a string of length (). The string is the concatenation of copies of the string .
입력
The first line contains , , and .
The second line contains the string of length . Every character is either an M or an O.
It is guaranteed that the number of decompositions of is nonzero.
출력
Output the number of decompositions of string , modulo .
예제 입력 1
2 6 1
MOOMOO
예제 출력 1
1
예제 입력 2
2 6 1
MMOOOO
예제 출력 2
6
예제 입력 3
1 4 2
MMOO
예제 출력 3
4
예제 입력 4
1 4 100
MMOO
예제 출력 4
976371285
점수
Inputs 5-7: , Inputs 8-10: , , Inputs 11-13: Inputs 14-19: Inputs 20-25: No additional constraints.
코드를 제출하려면 로그인이 필요합니다.
로그인제출 내역이 없습니다.
아직 맞은 사람이 없습니다.
제출 내역이 없습니다.