結果

問題 No.884 Eat and Add
ユーザー k-kk-k
提出日時 2019-09-23 14:43:50
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 796 ms / 1,000 ms
コード長 353 bytes
コンパイル時間 90 ms
コンパイル使用メモリ 11,748 KB
実行使用メモリ 10,260 KB
最終ジャッジ日時 2023-10-19 08:10:13
合計ジャッジ時間 5,239 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
9,884 KB
testcase_01 AC 31 ms
9,884 KB
testcase_02 AC 30 ms
9,884 KB
testcase_03 AC 650 ms
10,260 KB
testcase_04 AC 646 ms
10,260 KB
testcase_05 AC 597 ms
10,260 KB
testcase_06 AC 653 ms
10,260 KB
testcase_07 AC 488 ms
10,260 KB
testcase_08 AC 490 ms
10,260 KB
testcase_09 AC 796 ms
10,260 KB
testcase_10 AC 31 ms
9,884 KB
testcase_11 AC 30 ms
9,884 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
        elif t == 0:
            apples >>= 2
        else:
            apples >>= 1
    print(score)
0