其他分享
首页 > 其他分享> > HDU - 2018 :递推

HDU - 2018 :递推

作者:互联网

http://acm.hdu.edu.cn/showproblem.php?pid=2018

#include <stdio.h>
#include <cstring>
#include <algorithm>
#include <vector>
#include <map>
#include <assert.h>
#include <set>
#include <cmath>
#include <queue>
#include <cstdlib>
#include <iostream>
#include <bitset>
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
const int mxn = 1e2+5;
int n,m,k,t,dp[mxn],a[mxn];
int main()
{
    for(int i=1;i<55;i++)
        dp[i] = i<=4 ? i : dp[i-1]+dp[i-3] ;
    while(cin>>n)
    {
        if(n) cout<<dp[n]<<endl;
        else break;
    }
    return 0 ;
}

 

标签:HDU,int,long,mxn,2018,include,递推,define
来源: https://www.cnblogs.com/Shallow-dream/p/12248490.html