結果

問題 No.49 算数の宿題
ユーザー 👑 KazunKazun
提出日時 2020-06-10 20:53:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 72 ms / 5,000 ms
コード長 341 bytes
コンパイル時間 1,720 ms
コンパイル使用メモリ 86,640 KB
実行使用メモリ 71,428 KB
最終ジャッジ日時 2023-08-24 17:47:38
合計ジャッジ時間 1,860 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,352 KB
testcase_01 AC 71 ms
71,220 KB
testcase_02 AC 72 ms
71,208 KB
testcase_03 AC 70 ms
71,348 KB
testcase_04 AC 72 ms
71,396 KB
testcase_05 AC 71 ms
71,340 KB
testcase_06 AC 71 ms
71,388 KB
testcase_07 AC 71 ms
71,428 KB
testcase_08 AC 72 ms
71,336 KB
testcase_09 AC 71 ms
71,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S=input()
N=len(S)

S="*"+S
T=0
U="0"

p=0
f=0
for s in S:
    if s=="*" or s=="+":
        f=1
    else:
        U+=s

    if f:
        if p==0:
            T+=int(U)
        else:
            T*=int(U)
        U=""
        f=0

        if s=="*":p=0
        else:
            p=1

if p==0:
    T+=int(U)
else:
    T*=int(U)
    
print(T)
0