In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you how to solve the problem of borrowing books by Page in the C language algorithm. I hope you will get something after reading this article. Let's discuss it together.
1. Problem description
Page has five new books to lend to children A, B and C. if each person can only borrow one book at a time, how many different ways can he borrow it?
two。 Topic analysis
This problem belongs to the common permutation and combination problem in mathematics, that is, to find the total number of permutations and combinations of 3 different numbers from five numbers. We can number five books from one to five, and A, B and C can choose one of the five books each time, that is, each person has five choices, because it is impossible for one book to be lent to more than one person at the same time. Therefore, as long as the serial numbers of the books selected by these three individuals are different, it is an effective way to borrow them.
3. Algorithm design
For each person's selected book number, we can use exhaustive cycle, that is, from the range of each person's optional book number (1, 2, 3, 4, 5), so as to get feasible results. For the first person's choice, we can list it in a loop:: for (a = 1; a)
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.