結果
| 問題 |
No.3308 One-time Changed Formula
|
| コンテスト | |
| ユーザー |
kidodesu
|
| 提出日時 | 2025-10-24 21:26:59 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 128 ms / 2,000 ms |
| コード長 | 392 bytes |
| コンパイル時間 | 534 ms |
| コンパイル使用メモリ | 82,236 KB |
| 実行使用メモリ | 77,116 KB |
| 最終ジャッジ日時 | 2025-10-24 21:27:04 |
| 合計ジャッジ時間 | 2,362 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 15 |
ソースコード
for _ in range(int(input())):
n = int(input())
S = input()
f = 0
ans = 0
for s in S:
if f:
if not s in "-*+":
ans += int(s)-1
else:
if s in "-*+":
ans += 9
else:
ans += 9-int(s)
if s == "+":
f = 0
elif s == "-":
f = 1
print(ans)
kidodesu