結果
| 問題 |
No.3308 One-time Changed Formula
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-10-26 11:40:54 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 146 ms / 2,000 ms |
| コード長 | 279 bytes |
| コンパイル時間 | 308 ms |
| コンパイル使用メモリ | 82,104 KB |
| 実行使用メモリ | 77,052 KB |
| 最終ジャッジ日時 | 2025-10-26 11:41:00 |
| 合計ジャッジ時間 | 2,846 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 15 |
ソースコード
for _ in range(int(input())):
n=int(input())
f=input()
p=1
ans=0
for c in f:
if c in'-+*':
if p:
ans+=9
else:
c=int(c)
if p:
ans+=9-c
else:
ans+=c-1
if c=='-':
p=0
elif c=='+':
p=1
print(ans)