http://120.78.162.102/problem.php?cid=1432&pid=10

http://120.78.162.102/problem.php?id=6243

题解:暴力找规律

/*
*@Author:   STZG
*@Language: C++
*/
#include <bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<string>
#include<vector>
#include<bitset>
#include<queue>
#include<deque>
#include<stack>
#include<cmath>
#include<list>
#include<map>
#include<set>
//#define DEBUG
#define RI register int
using namespace std;
typedef long long ll;
//typedef __int128 lll;
const int N=1000;
const int MOD=1e9+7;
const double PI = acos(-1.0);
const double EXP = 1E-8;
const int INF = 0x3f3f3f3f;
int t,n,m,k,q;
int ans=0;
int vis[110];
void dfs(int x,int c){
    if(c>=n){
        ans++;
        return;
    }
    int l=max(1,x-2);
    int r=min(n,x+2);
    for(int i=l;i<=r;i++){
        if(!vis[i]){
            vis[i]=1;
            dfs(i,c+1);
            vis[i]=0;
        }
    }
}
int main()
{
#ifdef DEBUG
	freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
#endif
    ll a[N];
    a[1]=1;
    a[2]=1;
    a[3]=2;
    a[4]=4;
    for(int i=5;i<=100;i++)
        a[i]=a[i-1]+a[i-3]+1;
    while(~scanf("%d",&n)){
        //ans=0;
        //memset(vis,0,sizeof(vis));
        //vis[1]=1;
        //dfs(1,1);
        cout << a[n] << endl;
    }
    //cout << "Hello world!" << endl;
    return 0;
}