2 solutions
- 1
Information
- ID
- 679
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 6
- Tags
- # Submissions
- 15
- Accepted
- 12
- Uploaded By
一道经典的斐波那契,我懒得搞a和b,就直接打表了。
#include<iostream>
using namespace std;
int main(){
int a[21]={1,1};//初始前两个,注意n可能为0
for(int i=2;i<21;i++)//打表
a[i]=a[i-1]+a[i-2];
int n;
cin>>n;
cout<<a[n];
}
By signing up a ZXOJ universal account, you can submit code and join discussions in all online judging services provided by us.