算法来确定"通常"现金支付金额给定价格算法、金额、现金、价格

2023-09-11 04:13:15 作者:女人就要活得嚣张

您走进一家商店,选择一些产品,然后去柜台支付你的账单。总的是一定量( A )。你往你的钱包,钱包或口袋里,放下一些现金( P ),其中 P > = A ,和收银员给你换。

You walk into a store, select several products, then go to the counter to pay your bill. The total is some amount (A). You reach into your wallet, purse, or pocket and put down some cash (P), where P >= A, and the cashier gives you change.

由于集硬币和钞票是在流通,什么是 P中的最有可能的值

Given the set of coins and bills that are in circulation, what are the most likely values for P?

的一些例子,假定可用的纸币为$ 5,$ 10 $ 20 $ 50 $ 100,并且可用的硬币是图5c,10c和25c的

Some examples, assuming that the available bills are $5, $10, $20, $50 and $100, and the available coins are 5c, 10c and 25c:

A = $一百五十一点二四 P [1] = $ 160(8×$ 20)或($ 100 + 3X $ 20) P [2] = $ 155($ 100 + $ 50 + $ 5)

A = $151.24P[1] = $160 (8x$20) or ($100 + 3x$20)P[2] = $155 ($100 + $50 + $5)

A = $ 22.65 P [1] = $ 25($ 20±$ 5) P [2] = $ 30个($ 20+ $ 10) P [3] = $ 40($ 20+ $ 20)

A = $22.65P[1] = $25 ($20 + $5)P[2] = $30 ($20 + $10)P[3] = $40 ($20 + $20)

A = $ 0.95 P [1] = $ 1(4×25℃) P [2] = $ 5

A = $0.95P[1] = $1 (4 x 25c)P[2] = $5

许多这些数字似乎直觉,但我有一种感觉,该算法是很难牵制。

Many of these numbers seem intuitive, but I have a feeling that the algorithm is difficult to pin down.

推荐答案

此外,还有其他因素,你不可能用6×0.25付出,你会用1个1.00和2×0.25代替。一般来说0.25就没有了3个以上,0.10就没有超过2,和0.05就不会再有那么1。

There are also other factors, you are not likely to pay with 6 x 0.25, you would use 1 x 1.00 and 2 x 0.25 instead. Generally 0.25 would be no more then 3, 0.10 would be no more then 2, and 0.05 would be no more then 1.

另外,在现实世界中,很多人从来没有打扰值小于1.00,他们alawys付出与票据和不用找了。

Also in the real world, many people never bother with values less then 1.00, they alawys pay with bills and "keep the change".

同样适用于5.00,10.00,20.00,用于购买更多的则一两块钱的人将使用5.00或10.00代替。当然20.00是最常见的流通感谢ATM机。

Same applies to 5.00, 10.00, and 20.00, for purchases more then a couple of dollars people will use a 5.00 or 10.00 instead. Of course 20.00 are the most common in circulation thanks to ATM machines.

这是什么软件?你实际上是试图模型实际购买,需要准确的结果,或者是没有一个简单的模拟,以严谨?

What is this software for? are you actually trying model actual purchases and need accurate results, or a simple simulation which does not have to be rigorous?