题解 | #网购#

网购

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

#include <stdio.h>

int main() {
    int year, day, p;
    float price;
    scanf("%f %d %d %d", &price, &year, &day, &p);
    if (year == 11 && day == 11) {
        if (p == 1) {
            price = (price * 0.7) - 50;
            if (price < 0) {
                price = 0;
            }
            printf("%0.2f", price);

        } else {
            printf("%0.2f", price * 0.7);
        }
    } else if (year == 12 & year == 12) {
        if (p == 1) {
            price = (price * 0.8) - 50;
            if (price < 0) {
                price = 0;
            }
            printf("%0.2f", price);
        } else {
            printf("%0.2f", price * 0.8);
        }
    }
    return 0;
}
全部评论

相关推荐

02-28 01:18
已编辑
南昌大学 后端工程师
后测速成辅导一两个月...:把开源经历放个人项目上边应该更好,就像大部分人都把实习经历放个人项目上边
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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