Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
5928 詹梓涵 小明养猪的故事 C++ Wrong Answer 0 MS 256 KB 576 2024-12-21 10:13:31

Tests(0/1):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int T; cin>>T; for(int i=1;i<=T;i++){ int n,a1=1,a2=2,b; cin>>n; for(int i=1;i<=n;i++){ b=a1+a2; a1=a2; a2=b; } if(n==2) cout<<a1<<endl; if(n==1) cout<<a2<<endl; if(n>=3) cout<<b<<endl; } return 0; }


Run Info:

------Input------
17 1 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
------Answer-----
1 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765
------Your output-----
3 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711