RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
COCI00441

Klavir

Unrated 레이팅 미적용
난이도
1s
시간 제한
64MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

1 \(s / 64\) \(MB / 160\) points

Young Alisa likes to play the piano using only one finger. Unfortunately, Alisa never learned

to play the piano, so her playing is entirely random. More precisely, any time she chooses a

tone to play, she does it independently of all previous tones, and chooses each of the \(N\)

tones with the same probability.

Her good friend Mirta wants to listen to a composition containing \(M\) consecutive tones, but

since Alisa plays the piano randomly, Mirta does not know how long she will have to wait to

hear an array of exactly these \(M\) tones. Help Mirta determine the expected number of key

presses in order to hear, for the first time, her wanted array of consecutive tones. Moreover,

since Mirta is a very curious girl, she also wants to know the expected number of key

presses for each prefix of her wanted array of tones.

제약

In test cases worth 64 points in total, it will hold 1 ≤ \(M\)

≤ 200.

입력 형식

The first line of input contains the positive integer \(N\)

, the number of different piano tones (1 ≤
\(N\)

≤ 100).
The second line of input contains the positive integer \(M\)

, the length of the wanted array (1 ≤
\(M \le 10\) {6}{ }).
The third line of input contains the array of \(M\)

positive integers between 1 and \(N\)

.

출력 형식

The \(i\)^{th} of the following M lines must contain the expected number of key presses in order for
Mirta to hear the prefix of length \(i\)

of her wanted array of tones, modulo 10 {9}{ } + 7.
The test data will be such that the expected number of key presses will always be an integer.

예제 1
입력
2
2
1 2

2
2
1 1

3
3
1 2 3
출력
output
output
2
4

2
6

3
9
27
문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2016/2017 Contest 7

평가 및 의견

Klavir

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Klavir

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8