結果
問題 |
No.3114 0→1
|
ユーザー |
|
提出日時 | 2025-04-20 02:57:16 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 255 bytes |
コンパイル時間 | 497 ms |
コンパイル使用メモリ | 12,160 KB |
実行使用メモリ | 13,820 KB |
最終ジャッジ日時 | 2025-04-20 02:57:21 |
合計ジャッジ時間 | 4,309 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | WA * 30 |
ソースコード
n = int(input()) s = ['1', '1'] + list(input()) + ['1', '1'] n = len(s) ans = 0 for i in range(1, n-1): if s[i-1]=='0' and s[i]=='0': s[i] = '1' ans += 1 elif i+1<n and s[i-1]=='0' and s[i]=='1' and s[i+1]=='0': s[i+1] = '1' ans += 1 print(ans)