304 North Cardinal St.
Dorchester Center, MA 02124

# Vishesh and his Hate for Even Numbers CodeChef Solution – Queslers

## Problem: Vishesh and his Hate for Even Numbers CodeChef Solution

Vishesh just found an array AA having NN positive integers. He hates even numbers and would like to make the array full of only odd numbers. To do so, he is allowed to do the following operation.

• Pick a positive integer XX such that X=2YX=2Y for some non-negative integer YY. Then, for all elements AiAi in AA, if AiAi is divisible by XX, then we divide AiAi by XX (in other words, we assign Ai←AiXAi←AiX).

Let’s define f(B)f(B) as the minimum operations required to make an array BB have only odd numbers using the operation described above. Find the sum of f(a)f(a) over all subarrays aa of AA.

Note: A subarray of AA is acquired by removing some (possibly none) elements from the beginning and some (possible none) elements from the end of AA.

#### Input Format

• The first line of each input contains TT – the number of test cases. The test cases then follow.
• The first line of each test case contains an integer NN – the size of AA.
• The second line of each test case contains NN space-separated integers A1,A2,…,ANA1,A2,…,AN – the array AA.

#### Output Format

For each test case, output on a single line the answer to the problem.

#### Constraints

• 1≤T≤10001≤T≤1000
• 1≤N≤1051≤N≤105
• 1≤Ai≤1061≤Ai≤106
• Sum of NN over all test cases is not more than 5⋅1055⋅105

#### Sample Input 1

``````2
3
1 2 4
3
1 2 1
``````

#### Sample Output 1

``````7
4``````

#### Explanation

• Test case 11:
• [1][1] requires 00 operations.
• [1,2][1,2] requires 11 operation.
• [1,2,4][1,2,4] requires 22 operations.
• [2][2] requires 11 operation.
• [2,4][2,4] requires 22 operations.
• [4][4] requires 11 operation.

Therefore, sum of f(a)f(a) over all subarrays aa of AA is 77.

• Test case 22:
• [1][1] requires 00 operations.
• [1,2][1,2] requires 11 operation.
• [1,2,1][1,2,1] requires 11 operation.
• [2][2] requires 11 operation.
• [2,1][2,1] requires 11 operation.
• [1][1] requires 00 operations.

Therefore, sum of f(a)f(a) over all subarrays aa of AA is 44.

##### Vishesh and his Hate for Even Numbers CodeChef Solution Review:

In our experience, we suggest you solve this Vishesh and his Hate for Even Numbers CodeChef Solution and gain some new skills from Professionals completely free and we assure you will be worth it.

Vishesh and his Hate for Even NumbersName Problem is available on Hacker Rank for Free, if you are stuck anywhere between a compilation, just visit Queslers to get (Vishesh and his Hate for Even Numbers) CodeChef Solution.

##### Conclusion:

I hope this Vishesh and his Hate for Even Numbers CodeChef Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Hacker Rank, Leetcode, Codechef, Codeforce Solution.

This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.

Keep Learning!

More on Queslers >>

CodeChef Solution