結果
| 問題 |
No.3114 0→1
|
| コンテスト | |
| ユーザー |
ぽん🍊
|
| 提出日時 | 2025-04-19 23:51:21 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 498 bytes |
| コンパイル時間 | 355 ms |
| コンパイル使用メモリ | 82,356 KB |
| 実行使用メモリ | 71,412 KB |
| 最終ジャッジ日時 | 2025-04-19 23:51:25 |
| 合計ジャッジ時間 | 3,652 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | WA * 30 |
ソースコード
n = int(input())
s = [v for v in input()]
ans = 0
for i in range(n):
if s[i] == "1":
continue
if i - 1 >= 0 and i + 1 < n:
if s[i - 1] == "1" and s[i + 1] == "1":
continue
s[i] = "1"
ans += 1
elif i - 1 >= 0:
if s[i - 1] == "1":
continue
s[i] = "1"
ans += 1
else:
if s[i + 1] == "1":
continue
s[i] = "1"
ans += 1
print(ans)
ぽん🍊