简单的dp 一下就被田神秒了= = 注意long long
AC代码:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int maxn = 65;
int n;
long long dp[maxn];
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] + dp[i - 3] + 1;
while(scanf("%d", &n) != EOF)
printf("%I64d\n", dp[n]);
return 0;
}