All tasks
Mediummathstrings

Binary to Decimal

Time limit 2 s · Memory 64 MBAcceptance: —Solved by: 0

Statement

You are given a number in binary: a string of 0 and 1 characters (no extra leading zeros; zero itself is written as "0"). Print this number in decimal.

Examples

Example 1
Input
101
Output
5
Example 2
Input
0
Output
0

Constraints

  • String length is between 1 and 60
Solve this task to unlock the editorial.

AI tutor

Stuck? Get a nudge — the tutor explains the idea, it never hands you the solution.