题解 | #网购#

网购

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

#include <stdio.h>

int main() 
{
    double price;
    int month;
    int day;
    int paper;
    scanf("%lf %d %d %d", &price, &month, &day, &paper);
    if (month == 11 && day ==11)
    {
        price *= 0.7;
    }
    else if((month == 12 && day ==12))
    {
        price *= 0.8;
    }
    if(paper == 1)
    {
        price -= 50;
    }
    if (price < 0)
    {
        printf("0.00\n");
    }
   else
   printf("%.2lf", price);
    return 0;
}

全部评论

相关推荐

狄文君:多段项目经历 + 专业技能拉满,这简历很能打,坐等好消息!
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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