結果

問題 No.381 名声値を稼ごう Extra
ユーザー maspymaspy
提出日時 2020-03-17 13:13:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 494 bytes
コンパイル時間 219 ms
コンパイル使用メモリ 10,948 KB
実行使用メモリ 9,824 KB
最終ジャッジ日時 2023-08-20 14:17:31
合計ジャッジ時間 706 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,876 KB
testcase_01 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3.8
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def to_int(word):
    L = len(word)
    if len(word) < 10000:
        return int(word)
    mid = L // 2
    n1 = to_int(word[:mid])
    n2 = to_int(word[mid:])
    return pow(10, L - mid) * n1 + n2


popcount = {hex(n)[2]: sum(map(int, bin(n)[2:])) for n in range(16)}
answer = sum(popcount[x] for x in hex(to_int(read().rstrip()))[2:])
print(answer)
0