結果
問題 | No.49 算数の宿題 |
ユーザー | brthyyjp |
提出日時 | 2021-01-08 20:56:13 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 538 bytes |
コンパイル時間 | 298 ms |
コンパイル使用メモリ | 86,860 KB |
実行使用メモリ | 71,432 KB |
最終ジャッジ日時 | 2023-08-24 17:49:20 |
合計ジャッジ時間 | 1,666 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 75 ms
71,400 KB |
testcase_01 | AC | 70 ms
71,108 KB |
testcase_02 | AC | 69 ms
70,964 KB |
testcase_03 | AC | 71 ms
71,428 KB |
testcase_04 | AC | 71 ms
71,360 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | AC | 72 ms
71,248 KB |
testcase_09 | WA | - |
ソースコード
s = str(input()) stack = [] for c in s: if not stack: stack.append(c) else: if c != '*' and c != '+': if stack[-1] != '*' and stack[-1] != '+': stack[-1] += c elif stack[-1] == '*': stack.pop() x = stack.pop() stack.append(str(int(x)+int(c))) else: stack.pop() x = stack.pop() stack.append(str(int(x)*int(c))) else: stack.append(c) print(*stack)