Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
110485 何思佳 PELL数列 C++ Runtime Error 0 MS 268 KB 322 2025-02-22 10:17:13

Tests(0/10):


Code:

#include<bits/stdc++.h> using namespace std; int p[1001]; 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; }


Run Info:

Runtime Error:Segmentation fault