結果

問題 No.737 PopCount
ユーザー pawn0818pawn0818
提出日時 2018-09-28 22:39:02
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 666 bytes
コンパイル時間 86 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 17,820 KB
最終ジャッジ日時 2024-04-20 11:16:43
合計ジャッジ時間 5,617 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 TLE -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-
# !/usr/bin/env python
# vim: set fileencoding=utf-8 :

"""
#
# Author:   Noname
# URL:      https://github.com/pettan0818
# License:  MIT License
# Created: 金  9/28 22:33:48 2018

# Usage
#
"""
def get():
    return int(input())

def popcount(target):
    """
    >>> popcount(5)
    10
    """
    bin_num = bin(target)
    return sum([int(i) for i in list(bin_num[2:])]) * target

def solve(target):
    """
    >>> solve(10)
    23
    >>> solve(30)
    1333
    >>> solve(23072602871)
    123456789
    """
    res = 0
    for i in range(target):
        res += popcount(i)

    return res

if __name__ == '__main__':
    solve(get())
0