Submission #4637080
Source Code Expand
# -*- coding: utf-8 -*- import sys import math import copy def main(): S = input() S = list(S) length = len(S) con = [] for i in range(2 ** (length-1)): tmp = [] for j in range(length): if (i >> j) & 1 == 1: tmp.append("+") else: tmp.append("") con.append(tmp) ans = 0 for i, val in enumerate(con): counts = 0 tmp = copy.deepcopy(S) for j, vol in enumerate(val): if vol == "+": counts += 1 tmp.insert(j + counts, "+") lin = "".join(tmp) lin = lin.split("+") for i in lin: ans += int(i) print(ans) if __name__ == "__main__": main()
Submission Info
Submission Time | |
---|---|
Task | C - Many Formulas |
User | mochidan |
Language | Python (3.4.3) |
Score | 300 |
Code Size | 639 Byte |
Status | AC |
Exec Time | 30 ms |
Memory | 3540 KB |
Judge Result
Set Name | Sample | All | ||
---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||
Status | AC |
|
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 | 30 ms | 3540 KB |
02.txt | AC | 30 ms | 3540 KB |
03.txt | AC | 30 ms | 3540 KB |
04.txt | AC | 21 ms | 3412 KB |
05.txt | AC | 22 ms | 3412 KB |
06.txt | AC | 23 ms | 3412 KB |
07.txt | AC | 30 ms | 3540 KB |
08.txt | AC | 30 ms | 3540 KB |
09.txt | AC | 22 ms | 3412 KB |
10.txt | AC | 22 ms | 3412 KB |
sample_01.txt | AC | 22 ms | 3412 KB |
sample_02.txt | AC | 30 ms | 3540 KB |