题解 | #网购#

网购

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

#include <stdio.h>

int main() {
    float price,result;
    int month,day,n;
    scanf("%f %d %d %d",&price,&month,&day,&n);
    if(month == 11 && day == 11)
    {
        if(n == 1)
            result = price*0.7 -50;
        if(n == 0)
            result = price*0.7;
    }
    if(month == 12 && day == 12)
    {
        if(n == 1)
            result = price*0.8 -50;
        if(n == 0)
            result = price*0.8;
    }
    if(result < 0)
        result = 0;
    printf("%.2f",result);
    
    return 0;
}

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

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