Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
36519 黄子涵 小明养猪的故事 C++ Accepted 2 MS 724 KB 230 2022-08-09 12:09:39

Tests(1/1):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ int a[25]; int n,t; cin>>t; a[1]=1; a[2]=2; while(t--){ cin>>n; for(int i=3;i<=n;++i){ a[i]=a[i-1]+a[i-2]; }cout<<a[n]<<endl; } return 0; }