Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
34301 | yanxiaorui | 菲波那契数 | C++ | Accepted | 1 MS | 244 KB | 236 | 2023-12-17 19:19:33 |
#include<iostream> using namespace std; int main() { int k; cin>>k; int a1=1,a2=1,a3=0,i=2; if(k==1 or k==2) cout<<1; else{ do{ a3=a1+a2; a1=a2; a2=a3; i++; }while(i<k); cout<<a3; } return 0; }