题解 | #网购#
网购
http://www.nowcoder.com/practice/5d7dfd405e5f4e4fbfdff6862c46b751
function getDiscount(money, month, day, dis) {
var price;
if (month == '11') {
price = money * 0.7;
} else if (month == '12') {
price = money * 0.8;
}
if (dis == '1') {
price = price - 50;
}
if (price < 0) {
price = 0;
}
return price.toFixed(2);
}
var line = readline();
var array = line.split(' ');
console.log(getDiscount(parseFloat(array[0]), array[1], array[2], array[3]));
查看1道真题和解析