Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
110009 程余天皓 PELL数列 C++ Accepted 118 MS 528 KB 305 2025-02-14 10:57:30

Tests(10/10):


Code:

#include<bits/stdc++.h> using namespace std; int t,n; long long a[1000001]; int main() { cin >> t; while(t--){ cin >> n; a[1]=1; a[2]=2; for(int i=3;i<=n;i++){ a[i]=2*a[i-1]+a[i-2]; a[i]=((2*a[i-1])%32767+(a[i-2])%32767); } cout<<a[n]%32767<<endl; } return 0; }