adplus-dvertising

The Last Levels CodeChef Solution

We Are Discuss About CODECHEF SOLUTION

The Last Levels CodeChef Solution

The Last Levels CodeChef Solution

Chef is playing a videogame, and is getting close to the end. He decides to finish the rest of the game in a single session.

There are XX levels remaining in the game, and each level takes Chef YY minutes to complete. To protect against eye strain, Chef also decides that every time he completes 33 levels, he will take a ZZ minute break from playing. Note that there is no need to take this break if the game has been completed.

How much time (in minutes) will it take Chef to complete the game?

Input Format

  • The first line of input will contain a single integer¬†TT, denoting the number of test cases.
  • The first and only line of input will contain three space-separated integers¬†XX,¬†YY, and¬†ZZ.

The Last Levels CodeChef Solution

Output Format

For each test case, output on a new line the answer ‚ÄĒ the length of Chef’s gaming session.

Constraints

  • 1‚ȧT‚ȧ1001‚ȧT‚ȧ100
  • 1‚ȧX‚ȧ1001‚ȧX‚ȧ100
  • 5‚ȧY‚ȧ1005‚ȧY‚ȧ100
  • 5‚ȧZ‚ȧ155‚ȧZ‚ȧ15

Sample Input 1 

4
2 12 10
3 12 10
7 20 8
24 45 15

Sample Output 1 

24
36
156
1185

Explanation

The Last Levels CodeChef Solution

Test case¬†11:¬†There are¬†22¬†levels, each taking¬†1212¬†minutes. Chef thus needs a total of¬†2‚čÖ12=242‚čÖ12=24¬†minutes to complete them both, and no breaks are needed.

Test case¬†22:¬†There are¬†33¬†levels, each taking¬†1212¬†minutes. Chef thus needs a total of¬†3‚čÖ12=363‚čÖ12=36¬†minutes to complete all three. Since the game is completed after the third level, there is no need to take a break.

Test case¬†33:¬†There are¬†77¬†levels, each taking¬†2020¬†minutes. Here is Chef’s playthrough:

  • Chef completes the first three levels in¬†3‚čÖ20=603‚čÖ20=60¬†minutes, and then takes a break for¬†X=8X=8¬†minutes.
  • Next, he completes the fourth, fifth, and sixth levels in another¬†6060¬†minutes, and again takes a break for¬†88¬†minutes.
  • Finally, the seventh level is completed in¬†2020¬†minutes.

Chef’s session hence lasted for¬†60+8+60+8+20=15660+8+60+8+20=156¬†minutes.

SOLUTION

Yhaa You have done it but next? if YOU Want to Get Others Please Visit Here ScishowEngineer   Then Follow US HERE and Join Telegram.

If You Want To Learn Something New Then Visit Our Official Channel YOUTUBE

Related Posts

Leave a Reply

Your email address will not be published.