Time Limit: 1s
Memory Limit: 128MB
sort a sequence 1,2,3,...,n as the rule below:
1. the binary of the number has fewer '1' stand in front.
2. if tile just put the smaller one in front.
give you a number k, tell me it's position (count from 1) in the sequence.(1<=k<=n<=1000000)
The first line is n.
The second line is q indicate q questions.(q<=n)
next q lines, each one is the question about the position of the number.
output q lines, each line is a position.
8 4 1 3 4 8
1 5 3 4
For the case, after sort, the sequence is 1 2 4 8 3 5 6 7