#C3121. Car Rental Suggestion
Car Rental Suggestion
Car Rental Suggestion
You are given a list of cars available for rent. Each car is described by its type, cost per day, and seating capacity. The user specifies their preferred car type, a maximum cost per day, and a minimum required seating capacity. Your task is to suggest all the cars that match the user's preferences.
Let \( n \) be the number of available cars. Each car is represented as a tuple \((type, cost, seating)\). A car is considered suitable if:
- The car's type is equal to the user's preferred type.
- The cost per day \(cost\) does not exceed the maximum cost (i.e. \(cost \leq max\_cost\)).
- The seating capacity is at least the user's required minimum (\(seating \geq min\_seating\)).
If no car meets the criteria, output "No cars available".
inputFormat
The input is read from standard input (stdin) and has the following format:
n car1_type car1_cost car1_seating car2_type car2_cost car2_seating ... (n lines for n cars) preferred_type max_cost min_seating
Here, n is the number of cars. Each car details is provided in one line. The next line contains the preferred car type. The final line contains two integers: the maximum cost per day and the minimum seating capacity.
outputFormat
Output to standard output (stdout) should list the details of the cars that match the user's criteria. Each matching car should be printed on a separate line in the format:
car_type cost seating
If no car matches, output exactly "No cars available".
## sample5
Sedan 70 3
SUV 100 6
Convertible 150 4
Coupe 80 2
Sedan 60 4
Sedan
80 4Sedan 60 4