Zhengzhou University of Light Industry OJ python 1068: binary number

1068: binary number

Title Description

A binary number into a corresponding decimal number.

Entry

Enter a binary number, ending with a carriage return. The binary number is a positive number, length is not more than 31.

Export

Output an integer, the binary number for the corresponding decimal number.

Sample input

100000000001

Sample Output

2049

d=0
ch=input()
for i in ch:
    d=d*2+int(i)
print("%d"%d)
Published 73 original articles · won praise 0 · Views 415

Guess you like

Origin blog.csdn.net/weixin_42437183/article/details/104340187