Submission

Status:

PPPPP-----

Subtask/Task Score:

50/100

Score: 50

User: korn234

Problemset: อนุกรม

Language: cpp

Time: 0.002 second

Submitted On: 2026-09-19 13:08:55

#include <iostream>
using namespace std;
int main() {
	int n, a=1, b=1, c;
	cin>>n;
	if (n==1 || n==2){
		cout<<1;
		return 0;
	}
	for (int i=3; i<=n; i++){
		c=a+b;
		a=b;
		b=c;
	}
	cout<<b;
	return 0;
}