ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Разделы > Неотсортированные > задача:


Binary to decimal

Задачи раздела

• Round numbers
• Sum less than N
• Perfect numbers
• Sum of N numbers
• How many digits?
• find the numbers
• Fibonacci Series
• SAME OR DIFFERENT
• Binary to decimal
• Decimal to binary
• How many divisors?
• Find the biggest 2
• Find the biggest 3
• Tower of Happiness
• Going to the Movies
• A to the power of B
• X to the power of Y

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 1000/1000/1000/1000 мс. Лимит памяти 65000/65000/65000/65000 Кб.

Problem description

Binary is a number system used by digital devices like computers. The computer represents values using two voltage levels (usually 0V and +5V). With two levels we can represent exactly two different values. These could be any two different values, but by convention we use the values zero (0) and one (1).
It is very simple to convert binary into decimal. Just like the decimal system, we multiply each digit by its weighted position, and add each of the weighted values together. For example, the binary value 10011101 represents:
1*27 + 0*26 + 0*25 + 1*24 + 1*23 + 1*22 + 0*21 + 1*20 = 157.
Make a program that gets a binary number and prints its decimal equivalent as output.

Input

A nonempty sequence of 1 and 0 which length is not bigger then 64.

Output

Print decimal equivalent of given binary number.

Example

stdin stdout

110

6

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

www.contester.ru