Woburn Challenge 1995
Problem 2: Round Numbers
A positive integer N is said to be a "round number" if the binary representation of N has as many or more zeroes than ones. For example, the integer 9, when written in binary is form, is 1001. 1001 has two zeroes and two ones: thus 9 is a round number. The integer 26 is 11010 in binary; since it has two zeroes and three ones, it is not a round number.
An integer K (1 ≤ K < 231)
Indicate how many positive integers less than or equal to K are "round numbers" in the format shown below.
There are 5 round numbers less than or equal to 10.
Point Value: 15 (partial)
Time Limit: 1.00s
Memory Limit: 16M
Added: Sep 29, 2008
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3