Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
79248 张黄源 斐波那契数列 C++ Wrong Answer 0 MS 272 KB 532 2024-06-30 15:43:52

Tests(0/11):


Code:

#include <iostream> using namespace std; int main() { int n1=0,n2=1,n3,i,number; cout<<"Enter the number of elements: "; cin>>number; cout<<n1<<" "<<n2<<" "; //printing 0 and 1 //loop starts from 2 because 0 and 1 are already printed for(i=2;i<number;++i) { n3=n1+n2; cout<<n3<<" "; n1=n2; n2=n3; } return 0; } //更多请阅读:https://www.yiibai.com/cplusplus/fibonacci-series-in-cpp.html


Run Info:

------Input------
36
------Answer-----
14930352
------Your output-----
Enter the number of elements: 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 2178309 3524578 5702887 9227465