http://ybt.ssoier.cn:8088/problem_show.php?pid=1189


把1188的mod和递推公式修改一下即可。


#include<iostream>
using namespace std;
const int maxn=1000000;
const int mod=32767;
int f[maxn+1];


void init()
{
     f[1]=1;
     f[2]=2;
     for(int i=3;i<=maxn;i++)
     {
         f[i]=(2*f[i-1] + f[i-2])%mod;
     }   
}
int main()
{
     init();
     int n;
     cin>>n;
     while(n--)
     {
         int x;
         cin>>x;
         cout<<f[x]<<endl;
     }

    return 0;
}

相关文章:

  • 2021-10-02
  • 2022-12-23
  • 2021-08-15
  • 2022-01-25
  • 2021-09-19
  • 2022-12-23
  • 2021-12-24
  • 2021-06-14
猜你喜欢
  • 2022-12-23
  • 2022-02-25
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案