Answered step by step
Verified Expert Solution
Question
1 Approved Answer
in c++ Let's define f(x) as the number of times at which the integer x can be divided by 2 . You are given N
in c++
Let's define f(x) as the number of times at which the integer x can be divided by 2 . You are given N mumbers, and you should print the maximum f(x) among all these numbers. Input The first line contains one number N(1N105). The second line contains N space-separated numbers where each number is between 1 and 1018 (inclusive). Output Print the maximum f(x) among all numbers. Note In the first test case: 1. f(18) is equal to 1 : becouse we can divide 18 by 2 resulting in 9 , but we cannot divide 9 by 2 ( 9 is not divisible by 2 ). 2. f(24) is equal to 3 ; because we can divide 24 by 2 resulting in 12 ; again we can divide 12 by 2 (12 is divisible by 2 ) resulting in 6 ; again we can divide 6 by 2 (6 is divisible by 2 ) resulting in 3 , but we cannot divide 3 by 2 (3 is not divisible by 2); so we could divide 24 three times. 3. f(7) is equal to 0 ; because we cannot divide 7 by 2 Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started