結果
| 問題 |
No.708 (+ー)の式
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-07-30 00:34:14 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 28 ms / 2,000 ms |
| コード長 | 254 bytes |
| コンパイル時間 | 86 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-07-19 05:39:23 |
| 合計ジャッジ時間 | 1,238 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 |
ソースコード
S = input()
sgn = 1
rev = 1
ans = 0
for s in S:
if s.isdecimal():
ans += rev * sgn * int(s)
sgn = 1
elif s == '-':
sgn = -1
elif s == '(':
rev = sgn
sgn = 1
elif s == ')':
rev = 1
print(ans)