Submission

Status:

PPPPP-----

Subtask/Task Score:

50/100

Score: 50

User: KanemiyaKana

Problemset: อนุกรม

Language: cpp

Time: 0.004 second

Submitted On: 2026-09-24 15:43:47

#include <iostream>
#include <string>
using namespace std;

int serieslocation(int rank)
{
    long returnvalue = 0;
    long starter1 = 0;
    long starter2 = 1;

    for (int i = 0; i < rank - 1; i++)
    {                               // i | 1  2  3  4  5
        long temp = starter1;       //   | 0  0  1  1  2
        starter1 = starter2;        //   | 0  1  1  2  3
        starter2 = temp + starter2; //   | 1  1  2  3  5
    }

    returnvalue = starter2;
    return returnvalue;
}

int main()
{
    int input;
    cin >> input;
    if (0 >= input || input > 90)
    {
        return 0;
    }
    else
    {
        int output = serieslocation(input);
        cout << output;
    }
}