結果
問題 |
No.3114 0→1
|
ユーザー |
![]() |
提出日時 | 2025-04-19 23:48:51 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 498 bytes |
コンパイル時間 | 276 ms |
コンパイル使用メモリ | 81,968 KB |
実行使用メモリ | 84,348 KB |
最終ジャッジ日時 | 2025-04-19 23:48:54 |
合計ジャッジ時間 | 3,206 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | WA * 20 RE * 10 |
ソースコード
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)