/*
* 1326_1.cpp
*
* Created on: 2013年10月6日
* Author: Administrator
*/
#include <iostream>
#include <cstdio>
using namespace std;
int main(){
char begin[20];
char end[20];
char number[20];
int length;
int sum = 0;
while(scanf("%s",&begin) != EOF){
if(!strcmp(begin,"0")){
printf("%d\n",sum);
sum = 0;
continue;
}
if(!strcmp(begin,"#")){
break;
}
scanf("%s %d %s",&end,&length,&number);
if(!strcmp(number,"F")){
sum += (length*2);
}else if(!strcmp(number,"B")){
sum += ((length%2 == 0)?(length + length/2):(length + length/2 + 1));
}else{
if(length < 500){
sum += 500;
}else{
sum += length;
}
}
}
}
(poj1.1.3)1326(直叙式模拟)
最新推荐文章于 2022-04-15 21:29:07 发布
本文提供了一个使用C++编写的程序示例,该程序能够读取特定格式的输入,并根据输入的内容进行相应的计算处理。主要功能包括根据不同的指令符计算长度相关的数值。
1万+

被折叠的 条评论
为什么被折叠?



