Files
OI-source/history_source/信息学奥赛一本通/2.3.6.cpp
2023-08-03 09:22:52 +08:00

21 lines
203 B
C++

#include<cstdio>
int main()
{
int n;
scanf("%d",&n);
if(n<=2){
printf("%d\n",n);
return 0;
}
int a=1,b=2,c;
for(int i=3;i<=n;i++)
{
c=a+b;
a=b;
b=c;
}
printf("%d\n",c);
return 0;
}