Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
65283 万正钰 PELL数列 C++ Time Limit Exceeded 1000 MS 860 KB 435 2024-01-24 17:26:25

Tests(0/10):


Code:

#include<algorithm> #include<iostream> #include<cstring> #include<cmath> #include<iomanip> using namespace std; int a(int k){ if(k==1) return 1; if(k==2) return 2; else return 2*a(k-1)+a(k-2); } int main(){ int b[1000],n,m,ans=0; cin>>m; for(int i=1; i<=m;i++){ cin>>b[i]; } for(int i=1;i<=m;i++){ cout<<a(b[i])<<endl; } return 0; }