Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
110484 | 何思佳 | PELL数列 | C++ | Accepted | 37 MS | 1116 KB | 325 | 2025-02-22 10:16:38 |
#include<bits/stdc++.h> using namespace std; int p[1000001]; int pell(int k){ if (k==1){ return 1; } if (k==2){ return 2; } else if (p[k]==0){ p[k]=(pell(k-1)*2+pell(k-2))%32767; } return p[k]; } int t,k; int main(){ cin>>t; while(t--){ cin>>k; cout<<pell(k)<<endl; } return 0; }