Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
32187 王逸凡 PELL数列 C++ Accepted 72 MS 4636 KB 288 2022-07-23 11:37:19

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=3;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; }