結果

問題 No.737 PopCount
ユーザー convexineqconvexineq
提出日時 2021-03-16 17:00:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 36 ms / 1,000 ms
コード長 242 bytes
コンパイル時間 258 ms
コンパイル使用メモリ 82,296 KB
実行使用メモリ 53,572 KB
最終ジャッジ日時 2024-04-25 15:22:45
合計ジャッジ時間 1,834 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
52,596 KB
testcase_01 AC 36 ms
52,160 KB
testcase_02 AC 35 ms
52,756 KB
testcase_03 AC 36 ms
52,624 KB
testcase_04 AC 36 ms
52,188 KB
testcase_05 AC 35 ms
52,820 KB
testcase_06 AC 36 ms
52,316 KB
testcase_07 AC 35 ms
52,352 KB
testcase_08 AC 36 ms
53,008 KB
testcase_09 AC 35 ms
52,576 KB
testcase_10 AC 35 ms
53,068 KB
testcase_11 AC 36 ms
52,696 KB
testcase_12 AC 35 ms
53,156 KB
testcase_13 AC 36 ms
52,872 KB
testcase_14 AC 35 ms
52,916 KB
testcase_15 AC 35 ms
53,004 KB
testcase_16 AC 36 ms
52,320 KB
testcase_17 AC 35 ms
53,572 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def f(v,n):
    t = (n+1)//(2*v) - 1
    res = v*v*t*(t+1) + (t+1)*v*(3*v-1)//2
    x = v*(2*(t+1)+1)
    if n >= x:
        res += (n+x)*(n-x+1)//2
    return res

n = int(input())
ans = sum(f(1<<i,n) for i in range(62))
print(ans%(10**9+7))
0