Подразделы

Дата и время

03/05/2024 16:18:34

Авторизация

Имя:
Пароль:
Зарегистрироваться
Восстановить пароль
 

print1608. Lucky numbers

printLucky numbers

Ограничения: время – 1s/2s, память – 32MiB Ввод: input.txt или стандартный ввод Вывод: output.txt или стандартный вывод copy
Послать решение Blockly Посылки Темы Где Обсудить (0)

Digits 4 and 7 are lucky, while all others are unlucky. An integer is lucky if it contains only lucky digits in decimal notation. We would like to know the `K`-th lucky positive integer.
The first and only line of input contains a positive integer `K` (`1\ ≤\ K\ ≤\ 10^9`).
The first and only line of output must contain the `K`-th lucky positive integer.

Sample Input 1

1

Sample Output 1

4

Sample Input 2

2

Sample Output 2

7

Sample Input 3

3

Sample Output 3

44
Source: COCI 2010/2011, contest #1
loading