結果
| 問題 |
No.3308 One-time Changed Formula
|
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2025-10-25 02:14:55 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 358 ms / 2,000 ms |
| コード長 | 501 bytes |
| コンパイル時間 | 301 ms |
| コンパイル使用メモリ | 12,160 KB |
| 実行使用メモリ | 11,208 KB |
| 最終ジャッジ日時 | 2025-10-25 02:15:01 |
| 合計ジャッジ時間 | 5,298 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 15 |
ソースコード
T=int(input())
for tests in range(T):
N=int(input())
S=input().strip()
ANS=0
now=1
for x in S:
if "0"<=x<="9":
k=int(x)
if now==1:
ANS+=9-k
else:
ANS+=k-1
elif x=="+":
if now==1:
ANS+=9
now=1
elif x=="-":
if now==1:
ANS+=9
now=0
else:
if now==1:
ANS+=9
print(ANS)
titia