結果

問題 No.884 Eat and Add
コンテスト
ユーザー titia
提出日時 2025-03-17 03:10:07
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 151 ms / 1,000 ms
コード長 323 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 562 ms
コンパイル使用メモリ 21,536 KB
実行使用メモリ 17,404 KB
最終ジャッジ日時 2026-07-07 05:08:47
合計ジャッジ時間 3,547 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N=list(input().strip())
N.reverse()

N.append("0")
N.append("0")


ANS=0
ind=0
while ind<len(N):
    if N[ind]=="1" and N[ind+1]=="0":
        ANS+=1
        ind+=1
    elif N[ind]=="1" and N[ind+1]=="1":
        ANS+=1
        while N[ind]=="1":
            ind+=1
        N[ind]="1"
    else:
        ind+=1

print(ANS)

0