P1976 鸡蛋饼

题目链接:https://www.luogu.com.cn/problem/P1976

思路

图片说明

代码

#include<bits/stdc++.h>
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define debug  freopen("in.txt","r",stdin),freopen("out.txt","w",stdout);
#define PI acos(-1)
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn = 1e6+10;
const ll mod = 1e8+7;
using namespace std;

int N;
ll f[maxn];
int main(){
    // debug;
    ios;
    cin>>N;
    f[0] = 1;f[1] = 1;
    for(int i = 2;i<=N;i++){
        for(int j = 0;j<=i-1;j++){
            f[i] += f[j] * f[i-1-j];
            f[i] %= mod;
        }
    }
    cout<<f[N]<<'\n';
    return 0;
}