Very Hard Integers
Very Hard Integers PROBLEM STATEMENT : The program must accept two integers N and H as the input. If the binary representation of an integer contains 101 , then it is a hard integer. The hardness of an integer H is equal to the number of occurrences of 101 in its binary representation (with overlapping). The program must print the number of integers from 1 to N having the hardness greater than or equal to H as the output. Boundary Condition(s): 1 <= N <= 10 6 1 <= H <= 9 Input Format: The first line contains N and H separated by a space. Output Format: The first line contains an integer representing the number of integers from 1 to N having the hardness greater than or equal to H. Example Input/Output 1: Input: ( ) 50 1 Output: 20 Explanation: Here N = 50 and H = 1 . The integers having the hardness greater than or equal to 1 are given below. 5 -> 101 -> H = 1 10 -> 1010...