Google-Developer-Student-Club-CCOEW / Competitive-Coding

7 stars 51 forks source link

Question 78 #187

Closed Mahi1901 closed 2 years ago

Mahi1901 commented 2 years ago

You are given an integer N. You can repeat the following operation until N becomes 1.

Choose an integer X such that X>1 and X is a divisor of N and then divides N by X (the new value of N becomes N/X). If X is even, you get A points otherwise B points Can you find the maximum points obtainable if operations are performed optimally?

Input Format First line will contain T, number of testcases. Then the testcases follow. Each testcase contains of a single line of input containing three integers N,A,B.

Output Format For each testcase, output in a single line the maximum points obtainable.

Constraints 1≤T≤2⋅10^3 2≤N≤10^9 −10^3≤A,B≤10^3

Sample 1: Input 4 10 2 3 15 5 -2 12 2 3 8 -1 0 Output 5 -2 7 -1

NikitaMiraje commented 2 years ago

NIKITA MIRAJE CCOEW E&TC I would like to work on this issue...can you plz assign me this issue????

Mahi1901 commented 2 years ago

I have assigned. Happy coding!

NikitaMiraje commented 2 years ago

@Mahi1901 can you plz open this issue.....i am working on it

NikitaMiraje commented 2 years ago

@Mahi1901 I have created PR plz do check....