随笔分类 - 数学——组合+排列
摘要:题目链接:http://codeforces.com/problemset/problem/403/D/**算法分析: 这道题综合的考察了dp背包思想和组合数学*/#include#define MAXN 1050#define PI acos(-1.0)#define MOD 1000000007#define REP(i,n) for(int i=0; i>>">>"=d; i--) for(int j=min(d+1,50); j>=1; j--) dp[i][j] = (dp[i][j] + dp[i-d][j-1])%MOD;...
阅读全文
摘要:题目链接:http://lightoj.com/volume_showproblem.php?problem=1005#include #include #include #include #include #include #include using namespace std;const int maxe = 50000;const int maxn = 50;const int INF = 0x3f3f3f;float dp[maxn];long long C[maxn][maxn];long long A[maxn][maxn];int main(){ //freopen("
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4602我们可以特判出n 2 using namespace std; 3 const long long moder = 1e9 + 7; 4 5 long long power(long long t){ 6 if(t == 0) return 1; 7 long long ans = power(t/2) % moder; 8 ans = ans * ans % moder; 9 if(t % 2) ans = ans * 2 % moder;10 r...
阅读全文