Fzu 1116 mileage bank

Source: Internet
Author: User
Accept: 298 submit: 430
Time Limit: 1000 msec memory limit: 32768 kb problem descriptionmileage program of ACM (airline of charming Merlion) is really nice for the travelers flying frequently. once you complete a flight with ACM, you can earn acmperk miles in your ACM mileage bank depended on mileage you actual fly. in addition, you can use the acmperk mileage in your mileage bank to exchange free flight ticket of ACM in future.

The following table helps you calculate how many acmperk miles you can earn when you fly on ACM.

When you fly ACM Class Code You'll earn
First Class F Actual mileage + 100% mileage bonus
Business class B Actual mileage + 50% mileage bonus
Economy class
1-500 miles
500 + miles
Y 500 miles
Actual mileage

It's shown that your acmperk mileage consists of two parts. one is your actual flight mileage (the minimum acmperk mileage for economy class for one flight is 500 miles), the other is the mileage bonus (its accuracy is up to 1 mile) when you fly in business class and first class. for example, you can earn 1329 acmperk miles, 1994 acmperk miles and 2658 acmperk miles for y, B or F class respectively for the fly from Beijing to Tokyo (the actual mileage between Beijing and Tokyo is 1329 miles ). when you fly from Shanghai to Wuhan, you can earn acmperk 500 miles for economy class and acmperk 650 miles for business class (the actual mileage between Shanghai and Wuhan is 433 miles ).

Your task is to help ACM build a program for Automatic Calculation of acmperk mileage.

 

Inputthe input file contains several data cases. Each case has prepare flight records, each per line. The flight record is in the following format:

Originalcity distancecity actualmiles classcode

Each case ends with a line of one zero.

A line of one # presents the end of the input file.

 

 

Outputoutput the summary of acmpermileages for each test case, one per line.

 

Sample inputbeijing Tokyo 1329 F Shanghai Wuhan 433 Y 0 # sample output3158 // The question is mainly about the time # Include <iostream> <br/> using namespace STD; <br/> int main () <br/> {<br/> char c1 [50], c2 [50], ch; <br/> int Leng; <br/> double T = 0; <br/> while (scanf ("% s", C1 )) <br/> {<br/> If (strcmp (C1, "#") = 0) break; <br/> else if (strcmp (C1, "0 ") = 0) <br/>{< br/> printf ("%. 0f/N ", T); <br/> T = 0; <br/> continue; <br/>}< br/> scanf ("% S % d % * C % C", C2, & Leng, & Ch ); <br/> If (CH = 'F') <br/> T + = 2 * Leng; <br/> else if (CH = 'B ') <br/> T + = 3.0/2 * Leng; <br/> else if (CH = 'y ') <br/> {<br/> If (Leng <= 500) <br/> T + = 500; <br/> else <br/> T + = Leng; <br/>}< br/> return 0; <br/>}< br/>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.