• 沒有找到結果。

This line contains the serial of output followed by an integer which denotes the number of 1’s required to write all the values between a and b (inclusive) in binary

N/A
N/A
Protected

Academic year: 2021

Share "This line contains the serial of output followed by an integer which denotes the number of 1’s required to write all the values between a and b (inclusive) in binary"

Copied!
1
0
0

加載中.... (立即查看全文)

全文

(1)

12208 How Many Ones Needed?

To write binary numbers we need only two digits ‘0’ and ‘1’. To write a specific value we need a fixed number of ones, but of course number of zeroes may vary because of leading zeroes. For example to write values between 5 and 10 (inclusive) we need total 12 ones as shown in the figure on the left. You have to write a program that finds total number of ones that are required to write numbers in binary within a given range a and b.

Input

The input file can contain up to 11000 lines of inputs. Each line contains two positive integers a and b (0≤ a ≤ b ≤ 2000000000).

Input is terminated by a line containing two zeroes. This line should not be processed.

Output

For each line of input of input produce one line of output. This line contains the serial of output followed by an integer which denotes the number of 1’s required to write all the values between a and b (inclusive) in binary. Look at the output for sample input for details.

Sample Input 5 10

20 30 0 0

Sample Output Case 1: 12 Case 2: 35

參考文獻

相關文件

Write three nuclear equations to represent the nuclear decay sequence that begins with the alpha decay of U-235 followed by a beta decay of the daughter nuclide and then another

Directed numbers 2.1 understand the concept of directed numbers 9 Students are required to represent the directed numbers on the number line.. Students are required to

Teachers may consider the school’s aims and conditions or even the language environment to select the most appropriate approach according to students’ need and ability; or develop

Students are asked to collect information (including materials from books, pamphlet from Environmental Protection Department...etc.) of the possible effects of pollution on our

a) All water users are required to restrict their water use. b) Public water utilities shall limit the monthly use of water by their custo mers. They ma y do this by

The case where all the ρ s are equal to identity shows that this is not true in general (in this case the irreducible representations are lines, and we have an infinity of ways

SerialNumber specifies the desired serial number, allowing the call to open a specific Phidget.. Speci- fying -1 for the serial number will cause it to open the first

Microphone and 600 ohm line conduits shall be mechanically and electrically connected to receptacle boxes and electrically grounded to the audio system ground point.. Lines in