結果

問題 No.49 算数の宿題
ユーザー JunOnumaJunOnuma
提出日時 2017-06-14 16:38:32
言語 Python2
(2.7.18)
結果
AC  
実行時間 12 ms / 5,000 ms
コード長 326 bytes
コンパイル時間 73 ms
コンパイル使用メモリ 6,708 KB
実行使用メモリ 6,112 KB
最終ジャッジ日時 2023-08-24 17:37:16
合計ジャッジ時間 831 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
5,940 KB
testcase_01 AC 11 ms
5,996 KB
testcase_02 AC 11 ms
6,096 KB
testcase_03 AC 11 ms
5,852 KB
testcase_04 AC 11 ms
5,952 KB
testcase_05 AC 12 ms
5,996 KB
testcase_06 AC 12 ms
5,880 KB
testcase_07 AC 12 ms
6,112 KB
testcase_08 AC 11 ms
5,932 KB
testcase_09 AC 10 ms
5,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

s = raw_input()
l = []
p = 0
q = 0
while p < len(s):
    while q < len(s) and s[q] != '*' and s[q] != '+':
        q += 1
    l.append(int(s[p:q]))
    if q < len(s):
        l.append(s[q])
    q += 1
    p = q
n = l[0]
for i in range(1,len(l),2):
    if l[i] == '*':
        n += l[i+1]
    else:
        n *= l[i+1]
print n
0