Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
110007 彭林江 PELL数列 C++ Accepted 96 MS 528 KB 485 2025-02-14 10:52:04

Tests(10/10):


Code:

#include<bits/stdc++.h> using namespace std; int t, n;// t代表数据组数,也就是会问你几次, n是每一次问你的项数 long long a[1000001]; //int:-2147483648~2147483647 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)%32767; a[i] = a[i] % 32767; } cout << a[n] << endl;// } return 0; }