Division solution codechef
Chef has an integer. He repeats the following operation until becomes .
- Chef chooses an integer such that and is a divisor of and then divides by (the new value of becomes ). If is even, Chef gets points otherwise he gets points
Can you find the maximum points Chef can get if he performs the operations optimally?
Division solution codechef Input Format
- First line will contain , number of testcases. Then the testcases follow.
- Each testcase contains of a single line of input containing three integers .
Division solution codechef Output Format
For each testcase, output in a single line the maximum points Chef can get.
Division solution codechef Sample Input 1
4 10 2 3 15 5 -2 12 2 3 8 -1 0
Division solution codechef Sample Output 1
5 -2 7 -1
Test case: First Chef divides by and gets points and then divides by and thus gets points. Hence Chef gets a total of points.
Test case: Chef divides by . Hence he gets points.