HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Unsorted > problem:


Binary to decimal

Section problems

• 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

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

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