题解 | #牛牛的快递#

牛牛的快递

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

#include<stdio.h>
int main(){
    float weight = 0;
    char c = 0;
    int money = 0;
    scanf("%f %c",&weight,&c);
    if(weight<=1.0f)
            money = 20;
    else
    {
     if(weight-(int)weight>0) 
         money = 20 + (int)weight;
       else
           money = 20 + weight - 1;
     }
    if(c =='y')
        money = money + 5;
    printf("%d\n",money);
    return 0;
}

全部评论

相关推荐

深夜书店vv:腾讯是这样的,去年很多走廊都加桌子当工区
点赞 评论 收藏
分享
评论
1
1
分享

创作者周榜

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