#abc208b. B - Factorial Yen Coin
B - Factorial Yen Coin
Score : points
问题描述
在高桥王国中使用的硬币是-yen硬币、-yen硬币、以及-yen硬币。这里,。
高桥拥有每种面额的硬币各100枚,他打算购买一件价值为日元的产品,并准确支付,无需找零。
我们可以证明总是存在一种这样的支付方式。
在他的支付中至少需要使用多少枚硬币?
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
The coins used in the Kingdom of Takahashi are -yen coins, -yen coins, , and -yen coins. Here, .
Takahashi has of every kind of coin, and he is going to buy a product worth yen by giving the exact amount without receiving change.
We can prove that there is always such a way to make payment.
At least how many coins does he need to use in his payment?
Constraints
- is an integer.
Input
Input is given from Standard Input in the following format:
Output
Print the minimum number of coins needed.
Sample Input 1
9
Sample Output 1
3
By giving one -yen coin, one -yen coin, and one -yen coin, we can make the exact payment for the product worth yen. There is no way to pay this amount using fewer coins.
Sample Input 2
119
Sample Output 2
10
We should use one -yen coin, two -yen coins, three -yen coins, and four -yen coins.
Sample Input 3
10000000
Sample Output 3
24
update @ 2024/3/10 09:21:32