English 中文(简体)
购买X Y - 我如何理解其背后的内容?
原标题:Buy X get Y - How can I understand the math behind it?
  • 时间:2023-10-11 00:31:48
  •  标签:
  • c

我把购买X后数的数学混为一谈。 如果是《合同法》,就很容易计算你想要的物品数量和你必须支付的金额。 例如,当你想要4人时,你只得购买2美元和支付2美元,但购买3台的费用是免费的,或购买30台是免费的。 我认为非常容易地计算一下,在我的领导下,但在我试图找到一种反映这种情况的公式时,我会说(因为我的数学基础薄弱)。

Problem description

Calculate Total Cost after Subtracting Quantity of Free Promotional Products Each laundry detergent product sold by the store to consumers costs X VND. The store has a promotion: for every 10 products purchased (excluding the additional free ones), you get 1 product for free. The customer wants to buy n products. Calculate the total amount the customer has to pay for those n products. The input is the price of a product and the number of products the customer buys The output will be the amount the customer must pay (take up to 2 decimal places)

INPUT
50000 12
OUTPUT
550000.00

INPUT
50000 10
OUTPUT
500000.00

是否有办法代表钱?

问题回答

如果你购买0至x产品,你支付0至x美元。 如果你购买x+1至x+y,你支付x。 然后周期开始。

如果你想要生产产品,即整整年限值(n/(x+y),每周期就支付x产品,加上其余的上限 = n-下限(n/(x+y))=(x+y)。 其余部分,如果上限为0至x,或者如果上限为x+1至x+y,则由您支付。

如果是某一产品的价格,则总价为平价(n/(x+y))=x=p=p=或下限(n/(x+y)=x=p+x=p=p,根据该数值,中间价为平价。





相关问题
Fastest method for running a binary search on a file in C?

For example, let s say I want to find a particular word or number in a file. The contents are in sorted order (obviously). Since I want to run a binary search on the file, it seems like a real waste ...

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

Tips for debugging a made-for-linux application on windows?

I m trying to find the source of a bug I have found in an open-source application. I have managed to get a build up and running on my Windows machine, but I m having trouble finding the spot in the ...

Trying to split by two delimiters and it doesn t work - C

I wrote below code to readin line by line from stdin ex. city=Boston;city=New York;city=Chicago and then split each line by ; delimiter and print each record. Then in yet another loop I try to ...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...

Encoding, decoding an integer to a char array

Please note that this is not homework and i did search before starting this new thread. I got Store an int in a char array? I was looking for an answer but didn t get any satisfactory answer in the ...

热门标签