Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
6086 asdfghjkl123456789 小明养猪的故事 C++ 解答错误 0 0 MS 252 KB 343 2020-08-23 19:30:06

Tests(0/1):


#include<bits/stdc++.h> using namespace std; int f(int n){ int n1=1; int n2=1; int crab=0; int i=0; if(n<3){ return 2; }else{ for(i=0;i<n-1;i++){ crab=n1+n2; n1=n2; n2=crab; } return crab; } } int main(){ int a; cin>>a; for(;a>0;a--){ int x; cin>>x; cout<<f(x)<<endl; } return 0; }


测评信息:

输入

17
1
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

输出

2
5
8
13
21
34
55
89
144
233
377
610
987
1597
2584
4181
6765

答案

1
5
8
13
21
34
55
89
144
233
377
610
987
1597
2584
4181
6765

系统信息

exit code: 0, checker exit code: 0