Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
32190 郑皓 PELL数列 C++ Accepted 66 MS 4636 KB 306 2022-07-23 11:37:50

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--){ int k; cin>>k; cout<<a[k]<<endl; } return 0; }