其他分享
首页 > 其他分享> > poj 1326(水题)

poj 1326(水题)

作者:互联网

#include<iostream>
#include<cmath>
#include<cstring>
using namespace std;
int main(){
    int sum,mile;
    char a[2][20],icon[2];
    while(true){
        sum = 0;
        while(true){
            scanf("%s",a[0]);
            if(strcmp(a[0],"#")==0)return 1;
            if(strcmp(a[0],"0")==0)break;
            scanf("%s%d%s",a[1],&mile,icon);
            if(strcmp(icon,"F")==0){
                sum += mile*2;
            }
            if(strcmp(icon,"B")==0){
                sum += ceil(mile*1.5);
            }
            if(strcmp(icon,"Y")==0){
                if(mile<=500){
                    sum += 500;
                }
                else{
                    sum += mile;
                }
            }
        }
        printf("%d\n",sum);
    }
    return 0;
}

 

标签:1326,水题,int,sum,mile,poj,include,strcmp,icon
来源: https://www.cnblogs.com/stevenzrx/p/15552599.html