[BOJ 8523] Dice
View as PDFBytie likes playing with his m dice. His dice are not really typical: each of them has n faces with the respective faces containing 1, 2, ..., n pips. Bytie considers different arrangements of the dice in which the numbers of pips on the top of the dice form a sequence that is non-decreasing. Among two such arrangements, the one that has a smaller number of pips at the leftmost position where they differ is considered worse.</p>
Bytie is now enumerating all such arrangements starting from the worst arrangement with 1 pip on the top faces of all the dice. He is willing to reach the k-th arrangement in this sequence. Help him check if he made it correctly.
Write a program that
- reads the numbers m, n and k
- writes the k-th sequence in the desired order.
The only line of input contains three positive integers m, n and k (1 ≤ m ≤ 20, 4 ≤ n ≤ 50, 1 ≤ k ≤ 1018).
출력 형식
Your program should output m positive integers: the numbers of pipes on the top faces of the dice in the requested k-th arrangement. You may assume that the input is constructed in such way that this requested arrangement exists.</p>
예제 입력
3 4 3
예제 출력
1 1 3
Comments