POJ1326浅析------Mileage Bank

研发流程后端开发工具,提示功能开发效率 后端开发工具 立即下载
Mileage Bank
Time Limit: 1000MS Memory Limit: 10000K
Total Submissions: 11853 Accepted: 4925

Description

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			 Y

1-500 miles					 500 miles

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

Hint

When calculate bonus ,be sure you rounded x.5 up to x+1

Source

 
 
题目类型: 简单计算
 
题目大意:给你飞机的三种舱位,头等舱F,公务舱B和经济舱Y。已知两地地名,距离n,和所乘舱位种类。算其ACMPerk mileages。
                 F:ACMPerk mileages=2*n;   B:ACMPerk mileages=n+(n+1)/2;   Y:ACMPerk mileages=n<500?500:n.
 
 
我的代码如下:
#include<stdio.h>
#include<string.h>
int main()
{
    int n,sum;
    char a[100],b[100],c;
    while(scanf("%s",a)&&strcmp(a,"#")!=0)
    {
        sum=0;
        while(strcmp(a,"0")!=0)                                      
        {
            scanf("%s %d %c",b,&n,&c);
            if(c=='B')
                n+=(n+1)/2;
            else if(c=='F')
                     n*=2;   
            else if(c=='Y')
                     n=n<500?500:n;
            sum+=n; 
            scanf("%s",a);                        
        }
        printf("%d\n",sum);
    }
    return 0;    
}
备注:赤裸裸的水题!!!一些输入的格式细节应该注意一下!!!
 
 
 
 
 
 
 
 
 
 
Stata实战:DID平行趋势检验完整操作指南(附reghdfe+coefplot代码) 本文提供了一份使用Stata进行DID平行趋势检验的完整实战指南。文章详细讲解了从数据准备、生成相对时间变量,到利用reghdfe命令构建动态效应模型,以及使用coefplot命令进行结果可视化的全流程操作。核心在于通过检验政策前交互项的显著性,验证处理组与对照组是否满足平行趋势假设,为后续因果推断奠定可靠基础。 阅读详情

相关推荐

Unity游戏开发客户端Lua基础

Unity游戏开发客户端面经之 lua 篇

Sea3752的博客 1万+

poj1326

poj1326

zzu-hust-madd 355

STM32F103内部晶振配置实战:从代码修改到频率验证(附工程模板)

本文详细介绍了STM32F103内部晶振(HSI)的配置实战,从代码修改到频率验证的全流程,并附赠可直接使用的工程模板。通过对比HSI与外部晶振的优缺点,帮助开发者在成本敏感和空间受限的应用中实现稳定时钟配置,同时提供频率校准和常见问题排查方法。

weixin_29171087的博客 323

POJ-1326

import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) { String inLine=""; String

eddy_liu的专栏 750

open-web UI 实用指南

open-web UI 类似于chatgpt的界面,可以私有化模型本地部署,也可以用商业模型.本文只是用开源模型. 它以实现多模态AI聊天 , AI 翻译 , 语音转文本, 文本转语音, 文生图,代码助手,可谓利器。

szmars的博客 3万+

FFTW库安装与使用(3.3.5版本)

FFTW库安装与使用一、FFTW库介绍与下载二、FFTW库安装三、FFTW库测试 一、FFTW库介绍与下载   FFTW ( the Faster Fourier Transform in the West) 是一个快速计算离散傅里叶变换的标准C语言程序集,其由MIT的M.Frigo 和S. Johnson 开发。可计算一维或多维实和复数据以及任意规模的DFT,且运行速度比Eigen和opencv自带的FFT库函数快10倍以上。   下载链接:http://www.fftw.org/install/wind

Jhon_ranble的博客 2万+

poj1326(Mileage Bank)

Mileage Bank Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 11239   Accepted: 4694 Description Mil

ll365594480的专栏 1327

控制科学与工程(自动化)保研经验【4】——浙大篇

控制科学与工程(自动化)保研经验【4】——浙大篇

Control Everything 1万+

POJ1008浅析------玛雅历

POJ1008 玛雅历 题名描述: Description 上周末,M.A. Ya教授对古老的玛雅有了一个重大发现。从一个古老的节绳(玛雅人用于记事的工具)中,教授发现玛雅人使用了一个一年有365天的叫做Haab的历法。这个Haab历法拥有19个月,在开始的18个月,一个月有20天,月份的名字分别是pop, no, zip, zotz, tzec, xul, yoxkin, mol, ch

*Small eyes-Big world 1316

Ubuntu零基础教学-史上最详Ubuntu20.04安装教程,超级详细,强烈建议收藏!

官网地址:https://www.vmware.com/ 1、VMware Workstation Pro 15.5.1在Windows 10的安装不再介绍了,一路下一步即可。 2、下面详细介绍在VMware 虚拟机里安装Ubuntu 20.04 LTS的步骤

**My Coding Family** 2万+

【tessy】软件环境配置:Keil C51 Keil uVision UVSC (Default)

本文详细说明了tessy软件如何配置【Keil C51 Keil uVision UVSC (Default)】环境,具体操作步骤和注意事项

qq_37282365的博客 601

codeforces-230B-T-primes

题目链接:http://codeforces.com/problemset/problem/230/B B. T-primes time limit per test 2 seconds memory limit per test 256 megabytes input standard input output stand

*Small eyes-Big world 1202

Vue - 简约大气 404 页面

效果图 实现代码 复制即可。 <template> <div> <div class="error"> <!-- 图片可保存到本地 --> <img src="https://img-blog.csdnimg.cn/20210715111039922.png"> <p>抱歉!你访问的页面不存在或已删除 :( </p> <span class="back" @click="go(

🏆 前端领域优质创作者 3371

codeforces-230A-Dragons(贪心+排序)

题目链接:codeforces.com/problemset/problem/230/A A. Dragons time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output

*Small eyes-Big world 1147

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

poj1363----栈

简单题。         有一个火车站。有n节车厢从 车站A 驶入车站C,按进站顺序依次编号为1~n。         车站C具有栈的性质,其实就是栈。                判断能否借助中转站C使得各车厢按照题目要求的顺序驶入B站。           本题属于栈的基本操作。         第一次认真的去用栈来做题。 #include #include using na

*Small eyes-Big world 969

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

poj题目分类

原文地址:http://www.cnblogs.com/kuangbin/archive/2011/07/29/2120667.html 初期: 一.基本算法:      (1)枚举. (poj1753,poj2965)      (2)贪心(poj1328,poj2109,poj2586)      (3)递归和分治法.      (4)递推.      (5)构造法.(poj32

*Small eyes-Big world 785

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

poj2777-----线段树------位运算模拟线段染色------求区间颜色种数

树状数组建立线段树,每个节点表示颜色值,end表示。。。 此题比较好的是用位运算  抑或  模拟染色情况。 刚开始考虑用数组表示颜色,写着写着自己都不知道写的什么了。参考的大神的程序。 http://www.cnblogs.com/rainydays/archive/2011/05/14/2046419.html #include #include #include #incl

*Small eyes-Big world 777

poj2886线段树+反素数

题意: N个小朋友围一圈。 指定一个人为起始点之后,此人出圈。 按照这个人手中卡片的数字找到下一个人,下一个人出圈。 。。。 知道最后一个人出圈。 思路: 一:当期指定的人在第K个位置,他出圈后,找到下一个人在剩下的人中的位置next_K。 if(A >= 0) next_k = (k-1+A-1)%n + 1; else next_k = ((k-1

*Small eyes-Big world 766

poj3264线段树---区间最大最小值查询(RMQ)

求区间最大最小值的差值。 用树状数模拟组线段树建树,数组的每个节点保存:区间的左右两点 和 该区间的最大最小值。 注意区间查询的临界值的判断。 #include #define maxn 200010 #define lson l, m, rt<<1 #define rson m+1, r, rt<<1|1 #define inf 1000010 int c_min, c

*Small eyes-Big world 719

poj3468---线段树----区间单点更新、区间和查询----有延迟标记

树状数组线段树建树,每个节点表示该节点所在区间的和。 add [ ]数组用来标记当前节点所延迟的向下加和的数。 PushDown() 向下更新。 #include #define maxn 110000 #define lson l, m, rt<<1 #define rson m+1, r, rt<<1|1 #define LL long long int n, cas

*Small eyes-Big world 707

poj2823------线段树-------求区间最大最小值(RMQ)

如 POJ 3264。 inf 要定义足够大。 注意负数的情况。 判断时注意临界值。 线段树建树以及节点意义如POJ 3264。. #include #define maxn 1000010 #define lson l, m, rt<<1 #define rson m+1, r, rt<<1|1 int inf = 2100000010; int n, k; int

*Small eyes-Big world 670

poj3692----图论---二分图最大团

最大团 = 补图最大独立集 二分图最大独立集 = 全集-最小路径覆盖集 最小路径覆盖集  =  最大匹配 匈牙利算法: #include #include int g[301][301], vis[301], match[301], cnt; int n,m; int dfs(int v){ int i; for(i=1;i<=n;i++){

*Small eyes-Big world 668

POJ2070浅析------Filling Out the Team

Filling Out the Team Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 8634   Accepted: 4756 Description Over the years, the people of the great city of Pittsbur

*Small eyes-Big world 649

poj3785----全排序(STL---next_permutation())(a一送 五)

利用全排序,输出下一个比该数大的数。 要是这个数已经是最大的了。那么就输出"BIGGEST” 学习使用库函数 next_permutation() /** poj3785 */#include #include #include #include #include #include using namespace std; char str[1001]; int main() {

*Small eyes-Big world 647

poj2299-------------线段树求逆序数

数据过大,进行离散化。 注意: 线段树建树要注意数组为maxn四倍。(为此WA了一次)。 输出格式。 #include #include #include #define maxn 500010 #define lson l, m, rt<<1 #define rson m+1, r, rt<<1|1 int n; int a[maxn]; int b[maxn]; i

*Small eyes-Big world 629
上一篇: POJ1068浅析------Parencodings
下一篇: POJ1658浅析------Eva's Problem
monkey7777
博客等级 码龄15年 55粉丝 104原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值