Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
90509 | 包老师 | 斐波那契数列 | C++ | Accepted | 1 MS | 268 KB | 245 | 2024-09-15 13:51:21 |
#include <bits/stdc++.h> using namespace std; int main(){ int a=1,b=1; int k; cin>>k; if(k<=2){ cout<<1; } else{ int temp; for(int i=3;i<=k;i++){ temp = a+b; a=b; b=temp; } cout<<temp; } return 0; }