結果
問題 | No.222 引き算と足し算 |
ユーザー |
![]() |
提出日時 | 2018-08-03 16:02:46 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 28 ms / 1,000 ms |
コード長 | 461 bytes |
コンパイル時間 | 81 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-09-19 17:25:46 |
合計ジャッジ時間 | 2,115 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 31 |
ソースコード
s = input() if s.find("+-") != -1: s = s.replace("+-", "--") elif s.find("--") != -1: s = s.replace("--", "+-") elif s.find("++") != -1: s = s.replace("++", "-+") elif s.find("-+") != -1: s = s.replace("-+", "++") else: l = len(s) - 1 while True: if s[l] == '+': s = s[:l] + '-' + s[l+1:] break if s[l] == '-': s = s[:l] + '+' + s[l+1:] break l -= 1 print(eval(s))