結果

問題 No.49 算数の宿題
ユーザー convexineq
提出日時 2020-12-02 15:52:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 44 ms / 5,000 ms
コード長 315 bytes
コンパイル時間 365 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 51,840 KB
最終ジャッジ日時 2024-12-23 02:13:39
合計ジャッジ時間 1,358 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

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