結果

問題 No.3114 0→1
ユーザー Fogrex
提出日時 2025-04-19 09:30:19
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 189 bytes
コンパイル時間 659 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 60,416 KB
最終ジャッジ日時 2025-04-19 09:30:22
合計ジャッジ時間 3,047 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other WA * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
s = input()

count = 0
vs = 0
for i in range(n):
    if s[i] == "0":
        vs -= 1
    else:
        vs += 1
    if vs < 0:
        count += 1
        vs = 0
print(count)
0