题解 | #网购#
网购
http://www.nowcoder.com/practice/5d7dfd405e5f4e4fbfdff6862c46b751
#include<stdio.h> int main() { float money = 0; int m = 0; int d = 0; int flag = 0; float cut = 1.0; scanf("%f%d%d%d",&money,&m,&d,&flag); if(m == 11 && d == 11) { cut = 0.7; //折扣 } else if(m == 12 && d == 12) { cut = 0.8; //折扣 } money = money * cut - flag * 50; //根据flag的输入判断是否需要优惠50 if(money < 0) //商家不会倒找钱 { money = 0.0; } printf("%.2f",money); return 0; }