結果

問題 No.49 算数の宿題
ユーザー convexineqconvexineq
提出日時 2020-12-02 15:52:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 76 ms / 5,000 ms
コード長 315 bytes
コンパイル時間 288 ms
コンパイル使用メモリ 86,928 KB
実行使用メモリ 71,460 KB
最終ジャッジ日時 2023-08-24 17:49:02
合計ジャッジ時間 1,679 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,432 KB
testcase_01 AC 72 ms
71,332 KB
testcase_02 AC 72 ms
71,080 KB
testcase_03 AC 71 ms
71,336 KB
testcase_04 AC 76 ms
71,440 KB
testcase_05 AC 72 ms
71,336 KB
testcase_06 AC 72 ms
71,040 KB
testcase_07 AC 72 ms
71,460 KB
testcase_08 AC 72 ms
71,440 KB
testcase_09 AC 72 ms
71,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

a = 0
st1 = []
st2 = []
for i in input()+"+":
    if i=="*":
        st1.append(a)
        a = 0
        st2.append(0)
    elif i=="+":
        st1.append(a)
        a = 0
        st2.append(1)
    else:
        a = a*10+int(i)

ans = st1[0]
for i,s in zip(st1[1:],st2):
    if s: ans*=i
    else: ans+=i
print(ans)
0