Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
141474 胡海峰老师 斐波那契数列 C++ Accepted 0 MS 272 KB 571 2025-12-25 15:11:08

Tests(11/11):


Code:

#include <iostream> //designed by hu 2025-10 using namespace std; int main(){ int k; cin >> k; int a = 1; int b = 1; // cout << "NO 1:"<< a <<endl; // cout << "NO 2:"<< b <<endl; if (k==1) { cout<<1; return 0; //结束程序 } if (k==2) { cout<<1; return 0; //结束程序 } int c; for(int i=1;i<= k-2 ;i++) { c = a + b; // cout << "NO "<< i+2 <<":"<< c <<endl; a = b; b = c; } cout << c; /* Input 19 Output 4181 */ return 0; }