题解 | #网购#

网购

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

#include <stdio.h>

int main() 
{
    float price1, price2;
    int month, day, flag;
    scanf("%f %d %d %d", &price1, &month, &day, &flag);

    if (month == 11 & day == 11)
    {
        if (flag == 1)
        price2 = price1*0.7-50;
        else price2 = price1*0.7;
    }
    
    if (month == 12 && day == 12)
    {
        if (flag == 1)
        price2 = price1*0.8-50;
        else price2 = price1*0.8;
    }
    
    if (price2 < 0)
    price2 = 0;
    
    printf("%.2f\n", price2);

    return 0;
}

全部评论

相关推荐

我是没经验的毕业生,这啥情况啊会不会是hr在刷kpi
JamesGosli...:字节boss属于是群发了,我都快入职字节了,其他部门还在和我boss打招呼
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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