Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
32191 黄子涵 PELL数列 C++ Accepted 69 MS 4636 KB 328 2022-07-23 11:38:41

Tests(10/10):


Code:

#include<iostream> using namespace std; const int maxn=1e6+5; const int mod=32767; int a[maxn]; int main(){ a[1]=1,a[2]=2; for(int i=1+2;i<=1e6;++i){ a[i]=(2*a[i-1]%mod+a[i-2]%mod)%mod; } int n,k; cin>>n; while(n--){ cin>>k; cout<<a[k]<<endl; } return 0; }