Hot Search : Source embeded web remote control p2p game More...
Location : Home Search - coin calculation
Search - coin calculation - List
DL : 0
最小钱币数:这是一个古老而又经典的问题。用给定的几种钱币凑成某个钱数,一般而言有多种方式。例如:给定了6种钱币面值为2、5、10、20、50、100,用来凑 15元,可以用5个2元、1个5元,或者3个5元,或者1个5元、1个10元,等等。显然,最少需要2个钱币才能凑成15元。 你的任务就是,给定若干个互不相同的钱币面值,编程计算,最少需要多少个钱币才能凑成某个给出的钱数。 -The smallest coin: This is an old and classic. Given some coins to make up a certain amount of money, in general, have a variety of ways. For example: to set a six kinds of coins the nominal value of 2,5,10,20,50,100, used to scrape together $ 15, you can use $ 5, a five yuan, or $ 3, or a yuan, a-10 yuan, and so on. Clearly, at least two coins to make up 15 yuan. Your task is, to set a number of distinct nominal value of the coin, programming calculation, and requires a minimum number of coins to make up a given amount of money.
Date : 2025-12-20 Size : 166kb User : lzk
CodeBus is one of the largest source code repositories on the Internet!
Contact us :
1999-2046 CodeBus All Rights Reserved.