結果

問題 No.49 算数の宿題
ユーザー NoaSaberNoaSaber
提出日時 2021-04-30 18:29:36
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 72 ms / 5,000 ms
コード長 342 bytes
コンパイル時間 280 ms
コンパイル使用メモリ 86,976 KB
実行使用メモリ 71,452 KB
最終ジャッジ日時 2023-08-24 17:49:59
合計ジャッジ時間 1,642 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,304 KB
testcase_01 AC 70 ms
71,452 KB
testcase_02 AC 72 ms
71,240 KB
testcase_03 AC 71 ms
71,364 KB
testcase_04 AC 70 ms
71,396 KB
testcase_05 AC 71 ms
71,076 KB
testcase_06 AC 70 ms
71,392 KB
testcase_07 AC 70 ms
70,992 KB
testcase_08 AC 71 ms
71,168 KB
testcase_09 AC 70 ms
71,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S=input()
tmp=""
save=[]
ans=0
for i in S:
    if i=="*" or i=="+":
        save.append(int(tmp))
        save.append(i)
        tmp=""
    else:
        tmp+=i
if tmp!="":
    save.append(int(tmp))
ans=save[0]
for i in range(1,len(save),2):
    sign,nu=save[i],save[i+1]
    if sign=="*":
        ans+=nu
    else:
        ans*=nu
print(ans)
0