Lucky Numbers
Practice
3.7 (601 votes)
Easy
Problem
66% Success 30156 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code
Golu wants to find out the sum of Lucky numbers.Lucky numbers are those numbers which contain exactly two set bits.This task is very diffcult for him.So Help Golu to find sum of those numbers which exactly contain two set bits upto a given number N.
3 5 10 are lucky numbers where 7 14 are not.
INPUT
First line contain number of test cases T.Each test case contains a single number N.OUTPUT
Print sum of all Lucky Numbers upto N.Output may be large so take modulo with 1000000007.Constraints
1<=T<=105
1<=N<=1018
NOTE: Since value of test cases and n is really large, please use fast I/O optimization techniques.
Submissions
Please login to view your submissions
Similar Problems
Points:20
15 votes
Tags:
SortingBasic ProgrammingBit ManipulationMerge SortBasics of Bit ManipulationAlgorithmsBit manipulationBitmask
Points:20
156 votes
Tags:
Ad-HocApprovedBit manipulationEasyOpen
Points:20
46 votes
Tags:
Ad-HocApprovedBasic ProgrammingEasyOpen
Editorial