题解 | #牛牛的快递#

牛牛的快递

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

一定要考虑重量为整数的时候,这个写着写着就遗忘了
#include<iostream>
#include<iomanip>

using namespace std;
int main()
{
    float weight;
    int weight1,price,extraprice;
    char cha;
    cin>>weight>>cha;
    weight1=weight;
    if(cha=='y')
    {
        if(weight!=weight1&&weight>0)
        {
            cout<<int(weight1)+25;
        } 
        else cout<<int(weight1-1)+25;
    }
    if(cha=='n')
    {
        if(weight!=weight1&&weight>0)
        {
            cout<<int(weight1)+20;
        } 
        else cout<<int(weight1-1)+20;
    }
    return 0;
}

#牛客题霸#
全部评论

相关推荐

迟缓的马里奥求你们别...:我双2,FPGA方向,在成都找工作投了上百家,收到面试的不超过10家,是成都这个地方太有说法了。西南柬埔寨
秋招,不懂就问
点赞 评论 收藏
分享
评论
1
1
分享

创作者周榜

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