Akash and Function Codechef Solution | MARCH CHALLENGE

Thunder Bitz
2 min readMar 11, 2022
Akash and Function Codechef Solution | MARCH CHALLENGE

Akash and Function CodeChef Solution:

Akash has his maths test tomorrow. He secretly found out one of the questions from the test. As the test is online, he wants to write a code that solves the question. However, he is not good at coding and thus, wants Chef to help him with that.

Chef is given a function F(X)F(X) such that the condition:

- F(X)=F(2⋅X)F(X)=F(2⋅X)
holds true for all XX, where XX is a positive integer.

For a given positive integer NN, find the maximum number of distinct elements in the array .

Input Format

- First line will contain TT — the number of test cases. Then the test cases follow.

- Each test case contains a single line of input, one integer NN.

Output Format

For each test case, output in a single line, the maximum number of distinct elements in the array .

Constraints

- 1≤T≤10001≤T≤1000

- 1≤N≤1091≤N≤109

Subtasks

- Subtask 1 (30 points): 1≤N≤10001≤N≤1000

- Subtask 2 (70 points): Original Constraints.

Sample Input 1

2

2

5

Sample Output 1

1

3

Explanation

Test case 11: Let X=1X=1. Thus, 2=2⋅1=2⋅X2=2⋅1=2⋅X. Therefore, F(1)=F(2)F(1)=F(2). So, in the array , there is only 11 distinct element.

Test case 22: Here, we can take X=1X=1. Thus F(1)=F(2)F(1)=F(2). Similarly, if we take X=2X=2, F(2)=F(4)F(2)=F(4). This means that F(1)=F(2)=F(4)F(1)=F(2)=F(4).
However, it can be possible that the values F(1),F(3),F(1),F(3), and F(5)F(5) are distinct. Hence, the maximum number of distinct elements in the array is 33.

Akash and Function Codechef Solution

C++

Join our telegram group for codes.

Java

Will be Updated soon

Python

Will be Updated soon

Read More Post Here

--

--