1365_Mileage Bank

本文介绍了一种自动计算ACM航空公司里程积分的程序设计方案。该方案根据乘客飞行的实际里程及舱位等级,帮助旅客了解如何累积里程并兑换免费机票。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Mileage 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.


Input

The input file contains several data cases. Each case has many 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.


Output

Output the summary of ACMPerk mileages for each test case, one per line.


Sample Input

Beijing Tokyo 1329 F
Shanghai Wuhan 433 Y
0
#


Sample Output

3158

****************************************************************************************************************************************************

#include<iostream>
#include<string>
using namespace std;
int main()
{
string OriginalCity,DistanceCity;//其实是没用的
int ActualMiles;
int ACMPerk=0;
string ClassCode;
while(cin>>OriginalCity&&OriginalCity[0]!='#')//难点:#和0的嵌套
{
if(OriginalCity[0]!=48)
{   
cin>>DistanceCity>>ActualMiles>>ClassCode;

if(ClassCode[0]=='F')
 ACMPerk+=2*ActualMiles;
if(ClassCode[0]=='B')
  ACMPerk+=1.5*ActualMiles;
if(ClassCode[0]=='Y')
{
if(ActualMiles<=500)
ACMPerk+=500;
else
ACMPerk+=ActualMiles;
}
}
else 
{
  cout<< ACMPerk<<endl;
  ACMPerk=0;
}
}
return 0;
}






用r语言解决以下问题:Boston Housing Data. The Boston housing data set was collected by Harrison and Rubinfeld (1978). It comprise 506 observations for each census district of the Boston metropolitan area. The data set was analyzed in Belsley et al. (1980). • X1: per capita crime rate, • X2: proportion of residential land zoned for large lots, • X3: proportion of nonretail business acres, • X4: Charles River (1 if tract bounds river, 0 otherwise), • X5: nitric oxides concentration, • X6: average number of rooms per dwelling, • X7: proportion of owner-occupied units built prior to 1940, • X8: weighted distances to five Boston employment centers, • X9: index of accessibility to radial highways, • X10: full-value property tax rate per $10,000, • X11: pupil/teacher ratio, • X12: 1000(B−0.63)2 I(B < 0.63) where B is the proportion of African American, • X13: % lower status of the population, • X14: median value of owner-occupied homes in $1000. Car Data. The car data set Chambers et al. (1983) consists of 13 variables measured for 74 car types. The abbreviations in this section are as follows: • X1:P Price, • X2:M Mileage (in miles per gallone), • X3:R78 Repair record 1978 (5–point scale; 5 best, 1 worst), • X4:R77 Repair record 1977 (scale as before), • X5:H Headroom (in inches), • X6:R Rear seat clearance (distance from front seat back to rear seat, in inches), • X7:Tr Trunk space (in cubic feet), • X8:W Weight (in pound), 2 • X9:L Length (in inches), • X10:T Turning diameter (required to make a U-turn, in feet), • X11:D Displacement (in cubic inches), • X12:G Gear ratio for high gear, • X13:C Company headquarter (1 - U.S., 2 - Japan, 3 - Europe). Banknote Data. Six variables measured on 100 genuine and 100 counterfeit old Swiss 1000- franc bank notes. The data stem from Flury and Riedwyl (1988). The columns correspond to the following 6 variables: • X1: Length of the bank note, • X2: Height of the bank note, measured on the left, • X3: Height of the bank note, measured on the right, • X4: Distance of inner frame to the lower border, • X5: Distance of inner frame to the upper border, • X6: Length of the diagonal. Observations 1–100 are the genuine bank notes and the other 100 observations are the counterfeit bank notes. Job Applicants Data In this study, 48 individuals who had applied for a job with a large firm were interviewed and rated on 15 criteria. Individuals were rated on the form of their letter of application (FL), their appearance (APP), academic ability (AA), likability (LA), selfconfidence (SC), lucidity (LC), honesty(HON), salesmanship (SMS), experience (EXP), drive (DRV), ambition (AMB), ability to grasp concepts (GSP), potential (POT), keenness to join (KJ), and their suitability (SUIT). Each criterion was evaluated on a scale ranging from 0 to 10, with 0 being a very low and very unsatisfactory rating, and 10 being a very high rating.
06-05
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值