結果
問題 |
No.49 算数の宿題
|
ユーザー |
![]() |
提出日時 | 2025-05-05 18:32:56 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 29 ms / 5,000 ms |
コード長 | 561 bytes |
コンパイル時間 | 264 ms |
コンパイル使用メモリ | 12,032 KB |
実行使用メモリ | 10,496 KB |
最終ジャッジ日時 | 2025-05-05 18:33:06 |
合計ジャッジ時間 | 1,087 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
import math import sys def S(): return sys.stdin.readline().rstrip() def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int, sys.stdin.readline().rstrip().split()) def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) def LS(): return list(sys.stdin.readline().rstrip().split()) import re s = S() num = re.split('[*+]', s) op = re.split('[0-9]+', s) op = op[1:-1] ans = int(num[0]) for i in range(len(op)): if op[i] == '*': ans += int(num[i+1]) elif op[i] == '+': ans *= int(num[i+1]) print(ans)