Dynamic Discount on Products
问题 In the real world the discount on products you purchase is quite interesting. For example a seller offers a discount on his products in the following way: On buying one quantity there will be no discount On buying 2 he offers 10% discount On buying 4 and 5 disount will be 20% On 6 and onward 22% What is the best way to accomplish this in an eCommerce application? 回答1: Take a ceiling function of the exponent or approximation thereof. For example Discount = MaxDiscount * (1 - (N-1)/N), where N