提交时间:2023-11-27 13:28:09
运行 ID: 112585
#include<bits/stdc++.h> using namespace std; int main(){ int n,i,s = 0,a[1000]; cin>>n; for(i = 1;i <= n;i++){ if(i == 1){ a[1] = 1; }else if(i == 2){ a[2] = 2; }else{ a[i] = a[i - 1] + a[i - 2]; } } cout<<a[n]<<endl; }