题解 | #网购#
网购
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; }