题解 | #网购#

网购

https://www.nowcoder.com/practice/5d7dfd405e5f4e4fbfdff6862c46b751

#include <stdio.h>

int main() {
    int  b, c, d;
    float a,price;
    while (scanf("%f %d %d %d", &a, &b, &c, &d) != EOF) { // 注意 while 处理多个 case
        // 64 位输出请用 printf("%lld") to 
        if (b == 11 && c == 11)
        {
            if (1 == d)
            {
                price = a * 0.7 - 50;
            }
            else {
                price = a * 0.7;
            }
        }
        else
        {
            if (b == 12 && c == 12)
            {
                if (1 == d)
                    price = a * 0.8 - 50;
                else
                    price = a * 0.8;
            }
            else {
                price = a;
            }
        }
        if(price<0)
        price=0;

        printf("%.2f\n", price);
    }
    return 0;
}

全部评论

相关推荐

07-07 12:25
门头沟学院 Java
程序员牛肉:你这个智邮公司做的就是那个乐山市税务系统的服务吗?
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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