题解 | #牛牛的快递#

牛牛的快递

https://www.nowcoder.com/practice/41b42e7b3c3547e3acf8e90c41d98270

#include <stdio.h>

int main() {
    float weight=0;
    char chooce=0;
    int price=0;
    while (scanf("%f %c\n", &weight, &chooce) != EOF) { // 注意 while 处理多个 case
        // 64 位输出请用 printf("%lld") to 
        int m=weight/1;
        m=weight/1==m?m:m+1;
        if(chooce=='y')//加急,price加5元
        {
            price=20+5+m-1;
        }
        else if(chooce=='n')
        {
            price=20+m-1;
        }
        printf("%d\n", price);
    }
    return 0;
}

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务