結果

問題 No.884 Eat and Add
ユーザー stng
提出日時 2022-08-07 17:28:44
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 324 bytes
コンパイル時間 159 ms
コンパイル使用メモリ 82,068 KB
実行使用メモリ 63,364 KB
最終ジャッジ日時 2024-09-17 10:26:31
合計ジャッジ時間 1,303 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

n = "0"+"0"+input()
ans = 0
ln = len(n)
oc = 0
zc = 0
for i in range(ln-1,-1,-1):
    if n[i] == "1":
        oc += 1
    else:
        if i != ln-1 and n[i+1] == "0":
            ans += min(oc,zc+1)
            zc = 0
            oc = 0
        else:
            zc += 1
    #print(oc,zc,i)

#ans += min(oc,zc+2)
print(ans)
0