一道推公式的水题 0.0
跳舞毯
跳舞毯

#include<iostream>
using namespace std;
const int maxn=1001;
int main()
{
    int f[maxn];
    f[1]=0,f[2]=2,f[3]=2;
    for(int i=4;i<maxn;i++)
        f[i]=(f[i-1]%10000+(2*f[i-2])%10000)%10000;
    int n;
    while(cin>>n){
        if(n==0) break;
        cout<<f[n]<<endl;
    }
    return 0;
}

相关文章:

  • 2022-01-25
  • 2022-12-23
  • 2021-05-20
  • 2021-12-27
  • 2021-11-26
  • 2022-03-03
  • 2021-12-22
  • 2021-11-10
猜你喜欢
  • 2021-10-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-04
相关资源
相似解决方案