Submission
Status:
Compilation Error
Score: 0
User: www._.
Problemset: อนุกรม
Language: cpp
Time: 0.000 second
Submitted On: 2024-11-03 09:27:33
{\rtf1\ansi\ansicpg1252\cocoartf2818
\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
{\*\expandedcolortbl;;}
\paperw11900\paperh16840\margl1440\margr1440\vieww11520\viewh8400\viewkind0
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0
\f0\fs24 \cf0 #include <iostream>\
using namespace std; \
\
int main() \{\
int n;\
cin >> n;\
if (n==1 || n==2) \
\{\
cout << 1 << endl;\
return 0;\
\}\
\
int n1 = 1, n2 = 1, nextn;\
\
for(int i = 3; i <= n ; i++) \
\{\
nextn = n1+n2 ;\
n1 = n2;\
n2 = nextn;\
\}\
\
cout<<nextn<<endl;\
\
\
\}}