题目链接:https://ac.nowcoder.com/acm/contest/249/B 题目大意: 略 分析1(记忆化搜索): 方法为减而治之,把n划分成k份的答案就相当于每次把n分成a,b两个数,再把a分成k-1份,然后把每次a分成k-1份的答案相加即可.注意点是每轮分出来的b要不大于上一轮分出来的b. 代码如下: #include <bits/stdc++.h> using namespace std; #define rep(i,n) for (int i = 0; i <
Solution 注意取模!!! Code #include<bits/stdc++.h> #define mod 1000000007 #define LL long long using namespace std; int n, a, b; LL mpow(LL a, LL b) { LL ans = ; , a = a * a % mod) ) ans = ans * a % mod; return ans; } LL fac[], inv[], l[], t[]; void init