shunfurh 于 2017.09.17 21:00 提问
 Calculating Taxi Fare

Problem Description
The rules for calculating the taxi fares are quite complex. Many factors are to be considered in computing the taxi fares, including the length of the trip, the time of the day, the speed, etc. Every morning Bianca Bennett uses taxi to get to her office, she thinks if taximeters are programmed correctly. One day, she decided to write a program to calculate the taxi fares to check this.Imagine a taxi passes through a sequence of streets S1, S2, ..., Sn in order. The length of Si is Li and it is assumed that the taxi travels in a constant speed and it takes Mi minutes to travel one kilometer in Si. To make it simple, assume the passenger gets in at the start of a street Si and gets out at the end of the destination street Sj (i.e., he does not get in or out in the middle of a street). The passenger is charged for each kilometer of the trip. The first ten kilometers of the trip cost 1000 Rials each. The next 20 kilometers (from 11 to 30) cost 250 Rials each. After that, each kilometer costs 100 Rials.
During the night, the fare is increased by 20%. The rule is that for each kilometer, if the taxi travels at least one minute during the time interval [12 AM, 6 AM], that kilometer will cost 20% more. Since driving in a heavy traffic costs more, if the average speed of the taxi is less than 30 km/h during the whole trip, the fare is increased by 10%.
Input
The input consists of multiple test cases. The first part of each test case is the sequence of streets the taxi travels. This comes in several lines, each describing one street in the form of streetname length min. streetname is a unique string of at most 20 letters and digits with no blank in it, and length and min are two positive integer numbers which are Li; (measured in kilometers, at most 200) and Mi (measured in minutes) respectively. Each street is visited once by the taxi. The first part of the test case is terminated by a line containing a single $ character. The second part of the test case contains a single line of the form sourcestreet deststreet time. The first two items are the names of the source and the destination streets respectively. The third item is the time the passenger gets in which is in standard 24hours format (HH:MM). There is a line containing a single # character at the end of each test case. You may assume that the source and the destination streets belong to the input sequence of streets and the destination street does not come before the source street. The last line of the input contains two dash characters as shown in the sample input.Output
For each test case, output a line containing the fare of the passenger's trip.Sample Input
Khayyam 10 35
15thKhordad 50 15
Pamenar 15 40
$
Khayyam Pamenar 07:15
#
Jenah 10 40
Nouri 50 70
Hemmat 30 25
Chamran 80 80
ValieAsr 30 20
$
Nouri ValieAsr 23:30#
Sample Output
21758
36432
 caozhy 2017.10.01 04:21
 已采纳
 其他相关推荐
 ZOJ 3600【Taxi Fare】模拟
 Description Last September, Hangzhou raised the taxi fares. The original flagdown fare in Hangzhou was 10 yuan, plusing 2 yuan per kilometer after the first 3km and 3 yuan per kilometer after 10k
 Taxi Fare
 Last September, Hangzhou raised the taxi fares. The original flagdown fare in Hangzhou was 10 yuan, plusing 2 yuan per kilometer after the first 3km and 3 yuan per kilometer after 10km. The waiting
 省赛热身赛之_Taxi Fare
 原题： Description Last September, Hangzhou raised the taxi fares. The original flagdown fare in Hangzhou was 10 yuan, plusing 2 yuan per kilometer after the first 3km and 3 yuan per kilometer
 ZOJ 3600 Taxi Fare（数学）
 题目链接：http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4703Last September, Hangzhou raised the taxi fares.The original flagdown fare in Hangzhou was 10 yuan, plusing 2 yuan per kilometer aft...
 4288: Taxi Fare
 描述 Last September, Hangzhou raised the taxi fares. The original flagdown fare in Hangzhou was 10 yuan, plusing 2 yuan per kilometer after the first 3km and 3 yuan per kilometer after 10
 Z0J 3600 Taxi Fare
 题目链接： 题目意思： 分析：注意最后四舍五入，r
 ZOJ 3600 Taxi Fare【模拟】
 Taxi Fare Time Limit: 2 Seconds Memory Limit: 65536 KB Last September, Hangzhou raised the taxi fares. The original flagdown fare in Hangzhou was 10 yuan, plusing 2 yuan per kilometer a
 ZOJ 3600 Taxi Fare
 Description Last September, Hangzhou raised the taxi fares. The original flagdown fare in Hangzhou was 10 yuan, plusing 2 yuan per kilometer after the first 3km and 3 yuan per kilometer after 10k
 zoj 3600 Taxi Fare
 #include "iostream" using namespace std; int main() { int testcase; double s1, s2, ans, d, t; cin >> testcase; while (testcase) { cin >> d >> t; s1 = s2 = ans = 0; if (d <= 3) { s1