結果

問題 No.884 Eat and Add
ユーザー 👑 rin204rin204
提出日時 2022-07-14 13:51:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 95 ms / 1,000 ms
コード長 344 bytes
コンパイル時間 378 ms
コンパイル使用メモリ 87,144 KB
実行使用メモリ 80,008 KB
最終ジャッジ日時 2023-09-08 03:55:01
合計ジャッジ時間 2,641 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,232 KB
testcase_01 AC 73 ms
71,360 KB
testcase_02 AC 71 ms
71,480 KB
testcase_03 AC 95 ms
80,004 KB
testcase_04 AC 90 ms
80,008 KB
testcase_05 AC 91 ms
79,916 KB
testcase_06 AC 89 ms
79,868 KB
testcase_07 AC 82 ms
79,664 KB
testcase_08 AC 83 ms
79,536 KB
testcase_09 AC 85 ms
79,692 KB
testcase_10 AC 72 ms
71,408 KB
testcase_11 AC 76 ms
71,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S = input()
S = list(S[::-1] + "00")
ans = 0
car = False
n = len(S)
for i in range(n):
    if car:
        if S[i] == "0":
            S[i] = "1"
            car = False
        else:
            S[i] = "0"
    if S[i] == "1":
        ans += 1
        if S[i + 1] == "1":
            car = True
        else:
            car = False
print(ans)
0