当前位置:网站首页>Recursion and recursion
Recursion and recursion
2022-07-03 22:37:00 【four hundred and eighty-six thousand six hundred and fifty-seven】
Recurrence : Know the initial conditions , The initial condition is pushed upward until the target solution is obtained . The starting point of recursion is generally determined by the topic or the actual situation , Not derived from recursive relations . If the starting point of recursion cannot be determined , Then recursive algorithm cannot be realized . so , Recursive starting point is an important part of recursive algorithm .
Core code :
int main(){
cin>>N;
Bigint f[5010];
f[1]=Bigirt (1);
f[2]=Bigirt (2);
for (int i3=3;i<=N;i++)
f(i)=f(i-2)+f(i-1);
f(N).print();
return 0;
}
recursive thinking : Constructors , Call yourself when the function is running .
Recursive function is to call its own function , Often used to deal with factorials 、 Yang hui triangle 、 Fibonacci sequence, etc
边栏推荐
- 股票炒股开户注册安全靠谱吗?有没有风险的?
- JS Demo calcule combien de jours il reste de l'année
- File copy method
- STM32 multi serial port implementation of printf -- Based on cubemx
- 油猴插件
- Redis single thread and multi thread
- Why should enterprises do more application activities?
- Awk getting started to proficient series - awk quick start
- 4 environment construction -standalone ha
- Harbor integrated LDAP authentication
猜你喜欢
Blue Bridge Cup -- Mason prime
Code in keil5 -- use the code formatting tool astyle (plug-in)
webAssembly
2022 free examination questions for safety management personnel of hazardous chemical business units and reexamination examination for safety management personnel of hazardous chemical business units
pivot ROP Emporium
How to connect a laptop to a projector
Quick one click batch adding video text watermark and modifying video size simple tutorial
[Android reverse] application data directory (files data directory | lib application built-in so dynamic library directory | databases SQLite3 database directory | cache directory)
Learning notes of raspberry pie 4B - IO communication (SPI)
Harbor integrated LDAP authentication
随机推荐
string
Format cluster and start cluster
Correlation
6.2 normalization 6.2.5 third normal form (3NF)
Leetcode week 4: maximum sum of arrays (shape pressing DP bit operation)
The difference between SRAM and DRAM
Bluebridge cup Guoxin Changtian single chip microcomputer -- detailed explanation of schematic diagram (IV)
The 2022 global software R & D technology conference was released, and world-class masters such as Turing prize winners attended
How to connect a laptop to a projector
[dynamic programming] Ji Suan Ke: Suan tou Jun breaks through the barrier (variant of the longest increasing subsequence)
Harbor integrated LDAP authentication
How does sentinel, a traffic management artifact, make it easy for business parties to access?
On my first day at work, this API timeout optimization put me down!
Team collaborative combat penetration tool CS artifact cobalt strike
Plug - in Oil Monkey
540. Single element in ordered array
Unique in China! Alibaba cloud container service enters the Forrester leader quadrant
The reason why the computer runs slowly and how to solve it
SDNU_ ACM_ ICPC_ 2022_ Winter_ Practice_ 4th [individual]
320. Energy Necklace (ring, interval DP)