結果

問題 No.3114 0→1
ユーザー ああ
提出日時 2025-04-18 22:32:17
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 345 bytes
コンパイル時間 460 ms
コンパイル使用メモリ 12,032 KB
実行使用メモリ 12,384 KB
最終ジャッジ日時 2025-04-18 22:32:23
合計ジャッジ時間 4,883 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other WA * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = input()
s = []
for i in range(N):
	s.append(S[i])
ans = 0
for i in range(N-4):
	if s[i+2] == "0":
		if s[i] == "0" or s[i+1] == "0" or s[i+3] == "0" or s[i+4] == "0":
			s[i+2] = "1"
			ans = ans + 1 
if s[0] == "0" and s[1] == "0":
  ans = ans + 1
if s[-1] == "0" and s[-2] == "0":
  ans = ans + 1            
print(ans)			
0