In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly shows you the "sample analysis of Fibonacci series in SpringBoot", which is easy to understand and clear. I hope it can help you solve your doubts. Let me lead you to study and study the "sample analysis of Fibonacci series in SpringBoot".
For this problem, get the hand, immediately think of is: first find the Fibonacci sequence, and then find the remainder. But such a violent calculation is highly discouraged. Because when n is very large, the calculation time is long, and numerical overflow may occur!
So, here's another way of thinking: finding the remainder indirectly.
First of all, popular science has a remainder formula: (aquib)% c = (a%c+b%c)% c
This formula is not difficult to understand. You can try it on your behalf.
Therefore, it is not difficult to get: F (n)% m = [f (nmur1) + f (nMur2)]% m = [f (nmur1)% m (nmur2)% m]% m
As can be seen from the title, the final solution is f (n)% m, so that: G (n) = f (n)% m, where m is 10007.
So the recurrence formula of the remainder is: G (n) = [g (nmur1) + g (nMur2)]% m
Among them, mreply 10007 g (1) = g (2) = 1%m=1
The complete code is as follows:
# include using namespace std;int main () {int f1mlrect f2y1int temp=0; / / intermediate variable int output=0; / / output long noun 0; / / initialize input cin > > natives if (natives 1 | | natives 2) {output=1; / / when nasty 1 or 2, output is 1} else {for (int iTunes 3 miti)
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.