种小花
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
题目描述
为了美化环境,市长提出全民种花活动:第一户种1盆,第二户种1盆,第三户种2盆,第四户种3盆,第五户种5盆,第六户种8盆……以此类推,请问第n户要种多少盆?
输入格式
1个整数n,代表第几户(n<1000)。
输出格式
1个整数,代表第n户要种花的盆数。
输入/输出例子1
输入:
10
输出:
55
思路:
这是一个斐波拉契数列,第一二项都等于1,第三项开始都是它前两项的和,递推公式:a[i]=a[i-1]+a[i-2]。
递推
- Status
- Done
- Rule
- ACM/ICPC
- Problem
- 5
- Start at
- 2026-1-6 16:00
- End at
- 2026-1-15 0:00
- Duration
- 200 hour(s)
- Host
- Partic.
- 38