HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > Bil-273 1-Praktika 11.09.2019 > problem:


1. Decimal to binary

Bil-273 1-Praktika 11.09.2019

Start: Sep.11.2019 at 02:20:00 PM
Finish: Sep.11.2019 at 04:50:00 PM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (1)

Contest problems

• 1. Decimal to binary
• 2. Системы счисления
• 3. Совершенные числа
• 4. Triangle

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 1000/1000/1000/1000 ms. Memory limit 65000/65000/65000/65000 Kb.

Problem description

Make a program that gets a decimal number and prints its binary equivalent as output.

To convert a decimal number to its binary equivalent you can use the "short division by 2 remainder" method. This method relies only on division by two.

For example, let's convert the decimal number 156 to binary. Write the decimal number on the first line.
156
Divide it by 2 and write the integer answer (quotient) under it, and write the remainder (0 or 1) to the right of it.
156 0
78

Continue downward, dividing each new quotient by two and writing the remainders to the right of them. Stop when the quotient is 0.

156
78
39
19
9
4
2
1
0
0
0
1
1
1
0
0
1

Starting with the bottom-most remainder 1, read the sequence of 1's and 0's upwards to the top. You should have 10011100. This is the binary equivalent of the decimal number 156.

Input

A single integer N (0 ≤ N < 264).

Output

Print binary equivalent of given decimal number.

Example

stdin stdout

6

110

156 10011100
Для отправки решений необходимо выполнить вход.

www.contester.ru