結果
| 問題 |
No.3308 One-time Changed Formula
|
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2025-11-07 16:10:44 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 125 ms / 2,000 ms |
| コード長 | 588 bytes |
| コンパイル時間 | 348 ms |
| コンパイル使用メモリ | 82,048 KB |
| 実行使用メモリ | 97,940 KB |
| 最終ジャッジ日時 | 2025-11-07 16:10:47 |
| 合計ジャッジ時間 | 3,345 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 15 |
ソースコード
def main():
for _ in range(int(input())):
_ = int(input())
s = list(input())
f = True
ans = 0
for c in s:
if c=="+":
if f:
ans += 9
f = True
elif c=="-":
if f:
ans += 9
f = False
elif c=="*":
if f:
ans += 9
elif f:
ans += 9-int(c)
else:
ans += int(c)-1
print(ans)
if __name__ == "__main__":
main()