**Physical Address**

304 North Cardinal St.

Dorchester Center, MA 02124

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.

- 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.

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

- 1≤
*T*≤100 - 1≤
*X*≤1000

```
Input: 5
800
3
299
301
300
Output: 8000
3000
3000
3010
3000
```

**Test case 1:** The car runs for 800 kms. Thus, he needs to pay 800⋅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⋅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⋅10=3000 rupees.

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

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

```
#include <iostream>
using namespace std;
int main() {
int t,n;
int mcost=3000;
int cpkm=10;
cin>>t;
for(int i=0;i<t;i++){
cin>>n;
if(n<=300){
cout<<mcost<<endl;
}
else{
cout<<cpkm*n<<endl;
}
}
return 0;
}
```

```
T = int(input())
for i in range(T):
x = int(input())
if (x <=300):
x = 300
a = x*10
print(a)
else:
a = x*10
print(a)
```

```
import java.util.*;
import java.lang.*;
import java.io.*;
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0)
{
int drive=sc.nextInt();
if(drive<=300)
{
System.out.println("3000");
}else{
int cost_to_pay=drive*10;
System.out.println(cost_to_pay);
}
}
}
}
```

In our experience, we suggest you solve this Car Trip CodeChef Solution and gain some new skills from Professionals completely free and we assure you will be worth it.

If you are stuck anywhere between any coding problem, just visit Queslers to get the Car Trip CodeChef Solution

I hope this Car Trip CodeChef Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.

This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.

Keep Learning!

**More Coding Solutions >>**