結果
問題 | No.49 算数の宿題 |
ユーザー |
![]() |
提出日時 | 2016-08-11 22:11:06 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 33 ms / 5,000 ms |
コード長 | 453 bytes |
コンパイル時間 | 101 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-12-23 01:53:20 |
合計ジャッジ時間 | 1,027 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
S = input() num = -1 ns = [] ope = "" for i in S: if i.isdigit(): ns.append(i) else: if num != -1 and ope == "*": num = num + int("".join(ns)) elif num != -1 and ope == "+": num = num * int("".join(ns)) else: num = int("".join(ns)) ns = [] ope = i if ope == "*": num = num + int("".join(ns)) elif ope == "+": num = num * int("".join(ns)) print(num)