結果

問題 No.3114 0→1
ユーザー ArcAki
提出日時 2025-05-13 10:58:10
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 243 bytes
コンパイル時間 687 ms
コンパイル使用メモリ 82,352 KB
実行使用メモリ 95,568 KB
最終ジャッジ日時 2025-05-13 10:58:15
合計ジャッジ時間 4,125 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other WA * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
s = list(input())
pre = s[0]
cnt = 0
t = []
for c in s:
	if pre==c:
		cnt += 1 
	else:
		t.append((pre, cnt))
		pre = c
		cnt = 1 
t.append((pre, cnt))
ans = 0
for c, v in t:
	if c=="0" and v > 1:
		ans += (v+1)//2
print(ans)
0