码迷,mamicode.com
首页 > 其他好文 > 详细

HDU 5366 The mook jong

时间:2015-08-09 08:21:30      阅读:121      评论:0      收藏:0      [点我收藏+]

标签:

先暴力写了一个DFS,然后找规律。。

#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;

__int64 dp[1000];

int main()
{
    dp[1]=1;
    dp[2]=2;
    dp[3]=3;
    dp[4]=5;
    for(int i=5;i<=60;i++)
     dp[i]=dp[i-1]+1+dp[i-3];
    int n;
    while(~scanf("%d",&n))
     printf(
"%I64d\n",dp[n]); return 0; }

 

HDU 5366 The mook jong

标签:

原文地址:http://www.cnblogs.com/zufezzt/p/4714499.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!