結果
問題 |
No.737 PopCount
|
ユーザー |
![]() |
提出日時 | 2018-09-28 22:39:02 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 666 bytes |
コンパイル時間 | 150 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 16,000 KB |
最終ジャッジ日時 | 2024-10-12 06:56:02 |
合計ジャッジ時間 | 5,633 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 3 |
other | TLE * 2 -- * 13 |
ソースコード
# -*- 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())