Submission

Status:

-PPPPPPPPP

Subtask/Task Score:

90/100

Score: 90

User: Karatat007

Problemset: อนุกรม

Language: cpp

Time: 0.002 second

Submitted On: 2026-09-17 15:46:48

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

void print128(__int128 i){
    if(i==0){cout<<"0";return;}
    string s;
    while(i>0){ s+=char('0'+(int)(i%10)); i/=10; }
    reverse(s.begin(), s.end());
    cout<<s;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    __int128 old = 1;
    __int128 nw = 1;
    int n;
    cin >> n;
    if(n == 1 or n == 2){
        cout << '1';
    }
    for(int i = 1; i <= n - 2; ++i){
            nw = old + nw;
            old = nw - old;
    }
    print128(nw);
}