Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: Prima

Problemset: อนุกรม

Language: cpp

Time: 0.004 second

Submitted On: 2026-08-22 21:57:09

#include<iostream>
using namespace std;

int main(){
    int n;
    cin >> n;

    long long a=1, b=1, c;

    if(n==1 || n==2){
        cout << 1;
    }
    else{
        for(int i=3; i<=n; i++){
            c=a+b;
            a=b;
            b=c;
        }
        cout << b;
    }
}