1215:Gondwanaland Telecom

题目描述
Gondwanaland Telecom makes charges for calls according to distance and time of day. The basis of the charging is contained in the following schedule, where the charging step is related to the distance:
Charging
Step
Day Rate
8am to 6pm
Evening Rate
6pm to 10pm
Night Rate
10pm to 8am
A0.100.060.02
B0.250.150.05
C0.530.330.13
D0.870.470.17
E1.440.800.30

All charges are in dollars per minute of the call. Calls which straddle a rate boundary are charged according to the time spent in each section. Thus a call starting at 5:58 pm and terminating at 6:04 pm will be charged for 2 minutes at the day rate and for 4 minutes at the evening rate. Calls less than a minute are not recorded and no call may last more than 24 hours.


Write a program that reads call details and calculates the corresponding charges.
输入解释
Input lines will consist of the charging step (upper case letter 'A'..'E'), the number called (a string of 7 digits and a hyphen in the approved format) and the start and end times of the call, all separated by exactly one blank. Times are recorded as hours and minutes in the 24 hour clock, separated by one blank and with two digits for each number. Input will be terminated by a line consisting of a single #.
输出解释
Output will consist of the called number, the time in minutes the call spent in each of the charge categories, the charging step and the total cost in the format shown below.
输入样例
A 183-5724 17 58 18 04
#
输出样例
  183-5724     2     4     0  A    0.44

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-1215

最后修改于 2020-10-29 05:57:53 UTC 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 10000

·

·

·

·

登陆或注册以提交代码