結果
問題 | No.49 算数の宿題 |
ユーザー | YCesca |
提出日時 | 2016-09-08 15:16:55 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 19 ms / 5,000 ms |
コード長 | 588 bytes |
コンパイル時間 | 123 ms |
コンパイル使用メモリ | 10,808 KB |
実行使用メモリ | 8,004 KB |
最終ジャッジ日時 | 2023-08-24 17:34:02 |
合計ジャッジ時間 | 814 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 15 ms
7,984 KB |
testcase_01 | AC | 15 ms
7,992 KB |
testcase_02 | AC | 17 ms
8,004 KB |
testcase_03 | AC | 16 ms
7,872 KB |
testcase_04 | AC | 17 ms
7,852 KB |
testcase_05 | AC | 15 ms
7,812 KB |
testcase_06 | AC | 15 ms
7,892 KB |
testcase_07 | AC | 16 ms
7,800 KB |
testcase_08 | AC | 19 ms
7,800 KB |
testcase_09 | AC | 16 ms
7,796 KB |
ソースコード
s = input() stc = [] stc2 = [] ope = [] for i in s: if i.isdigit() == True: stc.append(i) else: ope.append("".join(stc)) stc = [] stc2.append(i) else: ope.append("".join(stc)) stc = [] for j in range(len(stc2)): ope.append(stc2.pop(0)) for k in ope: x = 0 if k.isdigit() == True: stc.insert(0,k) elif k == "+": x = int(stc.pop()) * int(stc.pop()) stc.append(str(x)) elif k == "*": x = int(stc.pop()) + int(stc.pop()) stc.append(str(x)) else: print(stc.pop())