提交时间:2023-12-17 19:23:39
运行 ID: 34303
#include<iostream> using namespace std; int main() { int n1=1,n2=1,n3,k,i; //k=第几个数 cin>>k; //1,1,2,3,5,8,13,21,34 if(k<=2){ cout<<'1'; }else{ i=3; while(i<=k){ n3=n1+n2; n1=n2; n2=n3; i++; } cout<<n3<<endl; } return 0; }