In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article focuses on "how to use Java to achieve currency combination", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "how to use Java to achieve currency combination"!
I will give you six banknotes with denominations of 1, 5, 10, 20, 50 and 100 yuan. Assuming that the number of each currency is enough, write a program to find the number of different combinations that make up N yuan (N is a non-negative integer of 010000 yuan). Analyze first
1: suppose the sum of 100 and 50 coins is num, and num = 0pr 50, 100 pr 150, 50 * (Nmax 50)
The combinatorial number is Z1 (100x + 50y = the number of nonnegative integer solutions of num)
There are k sheets at 2: 20, karma 0pm 1pm 2pm 3pm. , (N-num) / 20
3: so the sum of these coins is v1andv5andv10 = N-num-20 * k.
The number of combinations is Z2 (10x+5y
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.