結果

問題 No.884 Eat and Add
ユーザー H3PO4
提出日時 2021-03-06 09:19:34
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 153 ms / 1,000 ms
コード長 264 bytes
コンパイル時間 520 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 14,028 KB
最終ジャッジ日時 2024-10-08 03:10:23
合計ジャッジ時間 2,115 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

N = [0] + [int(x) for x in input()]
cur = len(N) - 1
ans = 0
while cur:
    if N[cur] == N[cur - 1] == 1:
        ans += 1
        while N[cur]:
            N[cur] = 0
            cur -= 1
        N[cur] = 1
    else:
        cur -= 1
ans += N.count(1)
print(ans)
0