题解 | #网购#

网购

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

#include<stdio.h>
int main()
{
    float price;
    int month,day,num;
    //num是优惠券的数量
    scanf("%f %d %d %d",&price,&month,&day,&num);
    //先判断日期,再判断是否有优惠券,再判断优惠券后商品的钱是否符合要求
        if(month==11 || day==11)
        {
            price=price*0.7;
            if(num==1)
            {
                price=price-50;
                if(price<0)
                {
                    price=0;
                }
            }
        }
        if(month==12 || day==12)
        {
            price=price*0.8;
            if(num==1)
            {
                price=price-50;
                if(price<0)
                {
                    price=0;
                }
            }
        }
    printf("%.2f",price);
}









全部评论

相关推荐

点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务