Submission #2379022


Source Code Expand

def return_binary(n, s):
    t = bin(n)[2:]
    while s > len(t):
        t = '0' + t
    t = t + '1'
    return t


def add_up(n, b):
    temp = ''
    total = 0
    for x in range(len(n)):
        temp = temp + n[x]
        if b[x] == '1':
            total = total + int(temp)
            temp = ''
    return total


raw_input = input()
length = len(raw_input)
tot = 0

if length == 1:
    print(raw_input)
else:
    for i in range(2**(length-1)):
        binary = return_binary(i, length-1)
        tot = tot + add_up(raw_input, binary)
    print(tot)

Submission Info

Submission Time
Task C - Many Formulas
User Doit
Language Python (3.4.3)
Score 300
Code Size 587 Byte
Status AC
Exec Time 20 ms
Memory 3064 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status AC
AC × 12
Set Name Test Cases
Sample
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, sample_01.txt, sample_02.txt
Case Name Status Exec Time Memory
01.txt AC 19 ms 3064 KB
02.txt AC 19 ms 3064 KB
03.txt AC 19 ms 3064 KB
04.txt AC 17 ms 3064 KB
05.txt AC 17 ms 3064 KB
06.txt AC 17 ms 3064 KB
07.txt AC 19 ms 3064 KB
08.txt AC 20 ms 3064 KB
09.txt AC 17 ms 3064 KB
10.txt AC 17 ms 3064 KB
sample_01.txt AC 17 ms 3064 KB
sample_02.txt AC 19 ms 3064 KB