Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: SayRo

Problemset: อนุกรม

Language: cpp

Time: 0.002 second

Submitted On: 2026-10-02 02:06:56

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int n;
ll series(ll x, ll y, int ct){
    if(ct==n) return x+y;
    return series(y,x+y,ct+1);
}

int main(){
    cin>>n;
    if(n<=2) cout<<1;
    else if(n==3) cout<<2;
    else{
        cout<<series(1,2,4);
    }
}