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

poj 1326(水题)

作者:互联网

#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int main(){
    char a[100],b[100],f[2],tmp[100];
    int m,sum;
    sum = 0;
    while(true){
        scanf("%s",tmp);
        if(!strcmp(tmp,"#")){
            break; 
        }
        else if(!strcmp(tmp,"0")){
            printf("%d\n",sum);
            sum = 0;
            continue;
        }
        strcpy(a,tmp);
        scanf("%s%d%s",b,&m,f);
        if(!strcmp(f,"F")){
            sum += m*2;
        }
        else if(!strcmp(f,"B")){
            sum += m+(m+1)/2;
        }
        else if(!strcmp(f,"Y")){
            if(m<=500){
                sum += 500;
            }
            else{
                sum += m;
            } 
        }
    }
    return 0;
}

 

标签:tmp,1326,水题,sum,else,poj,100,include,strcmp
来源: https://www.cnblogs.com/stevenzrx/p/15074719.html