Car Trip solution codechef-

Car Trip solution codechef

Solution – CLICK HERE

Chef rented a car for a day.

Usually, the cost of the car is Rs 10 per km. However, since Chef has booked the car for the whole day, he needs to pay for at least 300 kms even if the car runs less than 300 kms.

If the car ran X kms, determine the cost Chef needs to pay.

Car Trip solution codechef

  • The first line of input will contain a single integer T, denoting the number of test cases.
  • Each test case consists of a single integer X – denoting the number of kms Chef travelled.

Car Trip solution codechef

For each test case, output the cost Chef needs to pay.

Car Trip solution codechef

  • 1 \leq T \leq 100
  • 1 \leq X \leq 1000

Car Trip solution codechef

Input

Output

5
800
3
299
301
300
8000
3000
3000
3010
3000

Car Trip solution codechef

Test case 1: The car runs for 800 kms. Thus, he needs to pay 800\cdot 10 = 8000 rupees.

Test case 2: The car runs for 3 kms. However, since Chef booked the car for whole day, he needs to pay for at least 300 kms. Thus, he needs to pay 300\cdot 10 = 3000 rupees.

Test case 3: The car runs for 299 kms. However, since Chef booked the car for whole day, he needs to pay for at least 300 kms. Thus, he needs to pay 300\cdot 10 = 3000 rupees.

Test case 4: The car runs for 301 kms. Thus, he needs to pay 301\cdot 10 = 3010 rupees.

Test case 5: The car runs for 300 kms. Thus, he needs to pay 300\cdot 10 = 3000 rupees.

Solution – CLICK HERE

Leave a Comment