結果

問題 No.884 Eat and Add
ユーザー k-kk-k
提出日時 2019-09-23 14:46:37
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 765 ms / 1,000 ms
コード長 378 bytes
コンパイル時間 103 ms
コンパイル使用メモリ 11,816 KB
実行使用メモリ 10,328 KB
最終ジャッジ日時 2023-10-19 08:10:19
合計ジャッジ時間 5,267 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
9,964 KB
testcase_01 AC 34 ms
9,964 KB
testcase_02 AC 33 ms
9,964 KB
testcase_03 AC 634 ms
10,328 KB
testcase_04 AC 635 ms
10,328 KB
testcase_05 AC 591 ms
10,328 KB
testcase_06 AC 640 ms
10,328 KB
testcase_07 AC 488 ms
10,328 KB
testcase_08 AC 490 ms
10,328 KB
testcase_09 AC 765 ms
10,328 KB
testcase_10 AC 30 ms
9,964 KB
testcase_11 AC 30 ms
9,964 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

if __name__ == "__main__":
    apples = int(input(), 2)
    score = 0
    while apples != 0:
        t = apples & 3
        if t == 1:
            score += 1
            apples >>= 2
        elif t == 3:
            score += 1
            apples += 1
            apples >>= 2
        elif t == 0:
            apples >>= 2
        else:
            apples >>= 1
    print(score)
0