当前位置:网站首页>Basic exercises of test questions Fibonacci series
Basic exercises of test questions Fibonacci series
2022-06-13 02:07:00 【Jerry-hao】
This method is easy to burst the memory
f =[1]*1000000
n = int(input())
for i in range(3,n+1):
f[i]=(f[i-1]+f[i-2])%10007
print(f[n])
This is better :
f1 = 1
f2 = 1
n = int(input())
for i in range(n-2):
f = (f1+f2)%10007
f1 = f2
f2 = f
print(f2)
边栏推荐
- [the second day of the actual combat of the smart lock project based on stm32f401ret6 in 10 days] light up with the key ----- input and output of GPIO
- [printf function and scanf function] (learning note 5 -- standard i/o function)
- Restrict cell input type and display format in CXGRID control
- Rsync transport exclusion directory
- 10 days based on stm32f401ret6 smart lock project practice day 1 (environment construction and new construction)
- The commercial value of Kwai is being seen by more and more brands and businesses
- 万字讲清 synchronized 和 ReentrantLock 实现并发中的锁
- 华为设备配置虚拟专用网FRR
- Build MySQL environment under mac
- SQL server deletes all tables and all stored procedures in the database
猜你喜欢
Vivo released originos ocean, and the domestic customized system is getting better and better
[51nod.3210] binary Statistics (bit operation)
一、搭建django自动化平台(实现一键执行sql)
[learning notes] xr872 audio driver framework analysis
Use mediapipe+opencv to make a simple virtual keyboard
Get started quickly cmake
The scientific innovation board successfully held the meeting, and the IPO of Kuangshi technology ushered in the dawn
[the second day of the actual combat of the smart lock project based on stm32f401ret6 in 10 days] light up with the key ----- input and output of GPIO
华为设备配置私网IP路由FRR
Interruption of 51 single chip microcomputer learning notes (external interruption, timer interruption, interrupt nesting)
随机推荐
Application and examples of C language structure
C language conditional compilation routine
Day 1 of the 10 day smart lock project (understand the SCM stm32f401ret6 and C language foundation)
Swiper horizontal rotation grid
LabVIEW large project development tools to improve quality
Mac下搭建MySQL环境
华为设备配置虚拟专用网FRR
Devexpress implementation flow chart
STM32 IIC protocol controls pca9685 steering gear drive board
Sensor: MQ-5 gas module measures the gas value (code attached at the bottom)
dfs与bfs解决宝岛探险
How to do Internet for small enterprises
【 unity】 Problems Encountered in Packaging webgl Project and their resolution Records
蓝牙模块:使用问题集锦
Delphi implements adding a column of serial number to the CXGRID list
Uniapp preview function
Anti crawling strategy (IP proxy, setting random sleep time, bilbili video information crawling, obtaining real URLs, processing special characters, processing timestamp, and multithreading)
Huawei equipment is configured with dual reflectors to optimize the backbone layer of the virtual private network
swiper 横向轮播 grid
Combining strings and numbers using ssstream