题解 | #网购#

网购

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;
}
全部评论

相关推荐

2025-12-27 22:14
门头沟学院 Java
点赞 评论 收藏
分享
2025-12-11 14:24
门头沟学院 Java
在debug的伊泽瑞...:我说怎么这么眼熟查看图片
点赞 评论 收藏
分享
程序员花海:实习和校招简历正确格式应该是教育背景+实习+项目经历+个人评价 其中项目经历注意要体现业务 实习经历里面的业务更是要自圆其说 简历模板尽可能保持干净整洁 不要太花哨的
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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