PersonalCorpus 版 (精华区)

52909 2002-11-16 16:35:03 Accepted
1365 C++ 00:00.00 384K Big Guava

int main()
{
#ifndef ONLINE_JUDGE
    freopen("k:\\zju\\i1365","r",stdin);
    freopen("k:\\zju\\o1365","w",stdout);
#endif

    int i,j,k;
    char s[1000];

    while (1) {
        k=0;
        while (1) {
            gets(s);
            if (strcmp("0",s)==0) break;
            if (strcmp("#",s)==0) break;
            i=0;
            while (s[i]!=' ') i++;
            while (s[i]==' ') i++;
            while (s[i]!=' ') i++;
            while (s[i]==' ') i++;
            sscanf(s+i,"%d",&j);
            while (s[i]!=' ') i++;
            while (s[i]==' ') i++;
            if (s[i]=='F') k+=j+j;
            else if (s[i]=='B') k+=j*3/2;
            else if (j<=500) k+=500;
            else k+=j;
        }
        if (strcmp("#",s)==0) break;
        printf("%d\n",k);
    }
}
[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:1.916毫秒