Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
99055 | 蔡佳轩 | 斐波那契数列 | C++ | Wrong Answer | 3 MS | 264 KB | 481 | 2024-11-24 11:00:15 |
#include <iostream> using namespace std; int main(){ int n; cin>>n; for(int j=1;j<=n;j++){ int a; int x=1,y=1,z; cin>>a; if(a==1 || a==2){ //数列的第1项和第二项 cout<<x<<endl; } else{ for(int i=3;i<=a;i++){ //求第a项的值 z = x+y; x = y; y = z; } cout<<z<<endl; } } }
------Input------
36
------Answer-----
14930352
------Your output-----
727447837 727447837 727447837 727447837 727447837 727447837 727447837 727447837 727447837 727447837 727447837 727447837 727447837 727447837 727447837 727447837 727447837 727447837 727447837 727447837 727447837 727447837 727447837 727447837 727447837 727447837 727447837 727447837 727447837 727447837 727447837 727447837 727447837 727447837 727447837 727447837