문제2531--Tight words

2531: Tight words

실행시간 제한: 1 Sec  메모리사용 제한: 64 MB
제출: 2  통과: 2
[제출] [채점기록] [묻고답하기]

문제 설명

Given is an alphabet {0, 1, ... , k}, 0 <= k <= 9 . We say that a word of length n over this alphabet is tight if any two neighbour digits in the word do not differ by more than 1.

입력 설명

Input is a sequence of lines, each line contains two integer numbers k and n, 1 <= n <= 100.

출력 설명

For each line of input, output the percentage of tight words of length n over the alphabet {0, 1, ... , k} with 5 fractional digits.

입력 예시 Copy

4 1
2 5
3 5
8 7

출력 예시 Copy

100.00000
40.74074
17.38281
0.10130

출처/분류