All Tracks Basic Programming Operators Basics of Operators Problem

Going to office

Basic Programming, Operators


Alice has the following two types of taxis:

  • Online taxi: It can be booked by using an online application from phones 
  • Classic taxi: It can be booked anywhere on the road

The online taxis cost \(O_c\) for the first \(O_f\) km and \(O_d\) for every km afterward. The classic taxis travel at a speed of \(C_s\) km per minute. The cost of classic taxis are \(C_b\), \(C_m\), and \(C_d\) that represents the base fare, cost for every minute that is spent in the taxi, and cost for each kilometer that you ride.

You are going to the office from your home. Your task is to minimize the cost that you are required to pay. The distance from your home to the office is D. You are required to select whether you want to use online or classic taxis to go to your office. If both the taxis cost the same, then you must use an online taxi.

Input format

  • First line: Single integer \(D\) that denotes the distance from your house to the office
  • Next line: Three integers \(O_c\) , \(O_f\) , and \(O_d\)  
  • Next line: Four integers \(C_s\) , \(C_b\) , \(C_m\) , and \(C_d\)

Output format

If you select an online taxi to travel, then print a string 'Online Taxi'. Otherwise, select 'Classic Taxi'. You can print this string in a new, single line.


1 \(\leq\) \(D,\ O_c,\ O_f,\ O_d,\ C_s,\ C_b,\ C_m,\ C_d\) \(\leq\) 109

6 7 4
4 2 1 2
Online Taxi

If Felix choose to use Online Taxi, it will cost Felix a total of \(6 + (13 - 7) \times 4 = 30\)

While the classic taxi will cost Felix a total of \(2 + \lfloor \frac {13}{4} \rfloor \times 1 + 13 \times 2 = 31 \)

Therefore Felix will choose Online Taxi over Classic Taxi

Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 64 MB
Source Limit: 1024 KB

Best Submission

Similar Problems


This Problem was Asked in

Initializing Code Editor...
View All Notifications