题解 | #网购#

网购

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

#include <stdio.h>

int main() {
    double price = 0, cost = 0;
    int month = 0, date = 0, discount = 0;
    scanf("%lf %d %d %d", &price, &month, &date, &discount);
    if (month == 11 && date == 11) {
        cost = 0.7 * price;
        if (discount == 1)
            cost -= 50;
    }
    if (month == 12 && date == 12) {
        cost = 0.8 * price;
        if (discount == 1)
            cost -= 50;
    }
    if((int)(cost)<0)
    cost = 0;
    printf("%.2lf",cost);
}

全部评论

相关推荐

头像
11-21 11:39
四川大学 Java
是红鸢啊:忘了还没结束,还有字节的5k 违约金
点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务