Closed arpitgoyal27 closed 3 years ago
@arpitgoyal27 please don't submit the solutions to those questions which are part of ongoing contests. CodeChef considers it illegal and against its Code of Conduct. If you want to submit it, do it after the contest ends.
Ok sure
Chef is planning a heist in the reserve bank of Chefland. They are planning to hijack the bank for D days and print the money. The initial rate of printing the currency is P dollars per day and they increase the production by Q dollars after every interval of d days. For example, after dd days the rate is P+Qdollars per day, and after 2d days the rate is P+2Q dollars per day, and so on. Output the amount of money they will be able to print in the given period.
Input: -The first line contains an integer T, the number of test cases. Then the test cases follow. -Each test case contains a single line of input, four integers D,d,P,Q
Output: -For each test case, output in a single line the answer to the problem.
I will use c++.
problem link- https://www.codechef.com/JUNE21C/problems/CHFHEIST