0135. Combinations

Имя входного файла: combo.in
Имя выходного файла: combo.out
Ограничение по времени: 500 ms
Ограничение по памяти: 64 megabytes

A combination of k elements out of n is an increasing sequence of k integer numbers in range from 1 to n.

Combinations can be sorted in lexicographical order. Your task will be to find a specified combination by its position in that order.

Input file

Input file contains three integer numbers n, k, l (1 ≤ n ≤ 100, 1 ≤ k ≤ n, 1 ≤ l ≤ Cnk).

Output file

Output file must contain k integer numbers, separated by spaces – l-th combination of k elements out of n in lexicographical order.

Examples:

combo.incombo.out
3 3 11 2 3


Источник: Petrozavodsk Summer 2003. Blitz Kontest, Monday, August 25
Автор: Andrew Lopatin, Nick Durov

Обсудить       Отправить решение



Версия для печати