結果

問題 No.3114 0→1
コンテスト
ユーザー tatyam
提出日時 2025-04-19 09:42:26
言語 PyPy3
(8.0.0 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WJ  
(最新)
AC  
(最初)
実行時間 -
コード長 217 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
最終ジャッジ日時 2026-10-16 03:24:05
ジャッジサーバーID
(参考情報)
judge5_0 / judge3_0
このコードへのチャレンジ
(要ログイン)

ソースコード

diff #
raw source code

N = int(input())
S = bytearray(input().encode())
cnt = 0

for i in range(1, N):
    if S[i] == 49:
        continue
    if S[i - 1] == 48 or (i >= 2 and S[i - 2] == 48):
        S[i] = 49
        cnt += 1

print(cnt)
0