Going to office

3.7

311 votes
Basic Programming, Operators
Problem

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 Oc for the first Of km and Od for every km afterward. The classic taxis travel at a speed of Cs km per minute. The cost of classic taxis are Cb, Cm, and Cd 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 Oc , Of , and Od  
  • Next line: Four integers Cs , Cb , Cm , and Cd

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.

Constraints

1  D, Oc, Of, Od, Cs, Cb, Cm, Cd  109

Time Limit: 1
Memory Limit: 64
Source Limit:
Explanation

If Felix choose to use Online Taxi, it will cost Felix a total of 6+(137)×4=30

While the classic taxi will cost Felix a total of 2+134×1+13×2=31

Therefore Felix will choose Online Taxi over Classic Taxi

Editor Image

?