提交时间:2023-10-07 17:59:40

运行 ID: 105725

#include<bits/stdc++.h> using namespace std; int main() { int n; unsigned long long *f,*g; cin>>n; f=new unsigned long long[n+1]; g=new unsigned long long[n+1]; f[1]=1; f[2]=2; g[1]=0; g[2]=2; for(int i=3;i<=n;i++) { g[i]=f[i-2]*y+g[i-1]; f[i]=f[i-1]+f[i-2]+g[i-1]; } cout<<f[n]%10000; delete[] f; delete[] g; return 0; }