a073: Parking Fee 停車費計算
標籤 : 流程控制 迴圈
通過比率 : 91% (20 人 / 22 人 ) (非即時)
評分方式 :
Tolerant

最近更新 : 2019-04-09 09:00

內容

 Assume that the rate for a parking lot is calculated in units of half an hour, and that it is not charged for less than half an hour. Parking within 2 hours, 30 dollars per half hour; more than 2 hours, but less than 4 hours, 40 dollars per half hour; more than 4 hours, 60 dollars per half hour. Please write a program to calculate the total parking fee to be paid.

 

假設某個停車場的費率是以每半小時為單位計算,不滿半小時則不計費。  停車2小時以內,每半小時30元;超過2小時,但未滿4小時的部份,每半小時40元;超過4小時以上的部份,每半小時60元。請撰寫程式計算共需繳交的停車費。

 

輸入說明

The first line enters a positive integer N, which means that there are a total of N test data (1 ≤ N ≤ 100). Each test data contains two lines of time, starting and leaving time (24-hour clock). Each line contains two integers, representing the number of hours and minutes, separated by spaces.

 

 

第一行輸入一正整數N,表示共有N筆測試資料(1 ≤ N ≤ 100),每筆測試資料包含兩行時間,分別為開始與離開時間(24小時制)。每一行時間包含兩個整數,代表時數和分鐘數,兩數之間以空白隔開。

輸出說明

Output the parking fee, and a newline character should be added at the end of the output.

輸出停車費,最後必須有換行字元。

範例輸入
2
10 23
15 20
13 30
14 20
範例輸出
340
30
測資資訊 :
記憶體限制 : 64 MB
隱藏 測資點#0 (50%): 0.0s , <1K
隱藏 測資點#1 (50%): 0.0s , <1K
提示 :
標籤:
流程控制 迴圈
出處:
[編輯 :
shengZJ (shengZJ)
]


編號 身分 題目 主題 人氣 發表日期
沒有發現任何「解題報告」