题解 | #网购#

网购

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

#include<stdio.h>
int main()
{
    float price,discount_price;
    int month,date,flag;
    scanf("%f %d %d %d",&price,&month,&date,&flag);
    if(month==11&&date==11){
        discount_price=0.7*price;
        if(flag==1){
            discount_price=discount_price-50;
            if(discount_price<=0){
                discount_price=0;
                printf("%.2f",discount_price);
            }else{
                printf("%.2f",discount_price);
            }
        }else if(flag==0){
            printf("%.2f",discount_price);
        }
    }else if(month==12&&date==12){
        discount_price=0.8*price;
        if(flag==1){
            discount_price=discount_price-50;
            if(discount_price<=0){
                discount_price=0;
                printf("%.2f",discount_price);
            }else{
                printf("%.2f",discount_price);
            }
        }else if(flag==0){
            printf("%.2f",discount_price);
        }
    }else{
        printf("%.2f",price);
    }
    
    return 0;
}

全部评论

相关推荐

06-08 22:25
门头沟学院 Java
从零开始的转码生活:这hr不会打开手机不分青红皂白给所有人群发这句话,过一会再给所有人再发一遍,这肯定会有重复的,不管,再过一会再发一遍
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
2
2
分享

创作者周榜

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