题解 | #网购#
网购
https://www.nowcoder.com/practice/5d7dfd405e5f4e4fbfdff6862c46b751
#include <stdio.h> int main() { double price = 0, cost = 0; int month = 0, date = 0, discount = 0; scanf("%lf %d %d %d", &price, &month, &date, &discount); if (month == 11 && date == 11) { cost = 0.7 * price; if (discount == 1) cost -= 50; } if (month == 12 && date == 12) { cost = 0.8 * price; if (discount == 1) cost -= 50; } if((int)(cost)<0) cost = 0; printf("%.2lf",cost); }