题意及思路:https://www.cnblogs.com/chaoswr/p/9460378.html 代码: #include <bits/stdc++.h> #define LL long long using namespace std; const int maxn = 3010; const LL mod = 1000000007; LL dp[maxn][maxn]; char s[maxn][maxn]; int n, m; LL ans[4]; void solve(int
How Many Sets II Time Limit: 2 Seconds Memory Limit: 65536 KB Given a set S = {1, 2, ..., n}, number m and p, your job is to count how many set T satisfies the following condition: T is a subset of S |T| = m T does not contain continuous numbers
题目链接: http://www.lydsy.com/JudgeOnline/problem.php?id=4031 题解: Matrix-tree定理解决生成树计数问题,其中用到高斯消元法求上三角矩阵,其中消元用的是辗转相除法. 代码: #include<iostream> #include<cstdio> #include<cstring> using namespace std; const int mod = 1e9; ; typedef long long L