結果
| 問題 | No.3114 0→1 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-18 21:35:52 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 67 ms / 2,000 ms |
| コード長 | 264 bytes |
| 記録 | |
| コンパイル時間 | 231 ms |
| コンパイル使用メモリ | 95,856 KB |
| 実行使用メモリ | 86,784 KB |
| 最終ジャッジ日時 | 2026-07-09 18:57:20 |
| 合計ジャッジ時間 | 3,931 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 |
ソースコード
n = int(input())
s =list(input().rstrip())
ans = 0
for i in range(n):
if i-2 >= 0 and s[i-2] == '0' and s[i-1] == '1' and s[i] == '0':
s[i] = '1'
ans += 1
if i-1 >= 0 and s[i-1] == s[i] == '0':
s[i] = '1'
ans += 1
print(ans)