链接:https://ac.nowcoder.com/acm/challenge/terminal
来源:牛客网
一个整数 表示n (1<= n <= 1e3)
一个整数 表示答案模109
+7
7
#include<bits/stdc++.h> using namespace std; typedef long long LL; const int MAXN = 1e5+10; const int INF = 0x3f3f3f3f; const int N = 1010; const int MOD = 1e9+7; LL n; LL ans = 0; LL dp[N][N]; int main(){ while(scanf("%lld",&n)!=EOF){ ans = 0; memset(dp,0,sizeof(dp)); for(int i=0;i<=n;i++){ dp[i][0] = dp[i][i] = 1; } for(int i=1;i<=n;i++) for(int j=1;j<=n;j++) dp[i][j] = (dp[i-1][j-1] + dp[i-1][j]) % MOD; for(int i=0;i<=(n-1)/4;i++) ans = (ans + (dp[n-1][i*4] * dp[4*i][2*i]) % MOD) % MOD; cout<<ans<<endl; } return 0; }
转载自:https://blog.csdn.net/l18339702017/article/details/80786058
原文:https://www.cnblogs.com/tp25959/p/10345861.html