Fare Evaluator

3.7

11 votes
Problem

Statement: Sourav and his friends are in kolkata city and they are planning for a city tour. So, they booked a TUBER cab (Stop Giggling). Please help them to find the estimated fare according to the fare evaluator system of TUBER cabs.

How to evaluate fare?

  • For first 2 Kilometers, Fare is 50 units (i.e., Base Charge or Minimum Charge).
  • For more than 2 Kilometers, Fare is 12 units/Kilometer (except first 2 Kilometers).
  • Waiting charge is 2 units/min.
  • Maximum distance travelled by cab services is 60 Kilometers.

Input: First line of input containts T, i.e., number of test cases, followed by T lines each containing-

  • Total distance, D
  • Waiting time, WT (in minutes)

D & WT are space seperated values on each line.

Output: T lines each containing estimated fare. If D exceeds maximum distance travel value, print NA.

Constraints: 1<=T<=100 | 1<=D<=60 | 1<=WT<=250

Time Limit: 5
Memory Limit: 256
Source Limit:
Explanation

In the above sample input,

  • For the 1st case, D=5 and WT=2, so estimated fare is 90 units.
  • For the 3rd case, D=61 and WT=3, since TUBER cabs do not travel beyond 60 kilometers, so output is NA.
Editor Image

?