#38184: 不能一直遞迴會超時


11131039@stu.tshs.tp.edu.tw (林孟希)

學校 : 國立臺灣大學
編號 : 201083
來源 : [140.112.25.29]
最後登入時間 :
2025-09-26 16:05:38

#include <bits/stdc++.h>
using namespace std;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    long long n; cin>>n;
    long long table[3]={0,1,1};
    for(int i=2;i<n;i++)
    {
        table[2]=table[0]+table[1];
        table[0]=table[1];
        table[1]=table[2];
    }
    cout<<table[2];
}