Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: pupu

Problemset: อนุกรม

Language: cpp

Time: 0.005 second

Submitted On: 2026-10-04 09:21:54

#include <iostream>
using namespace std;
int main(){ios::sync_with_stdio(0);cin.tie(0);
    long long int a=1,b=1,n,x=0;
    cin>>n;
    if(n==1 or n==2){
        cout<<1;
        return 0;
    }
    for(int i=0;i<(n-2);i++){
        x=a+b;
        a=b;
        b=x;
    }
    cout<<b;
}