Matrix-tree定理,给出一个无向图,问求出的生成树方案有多少种方案,利用Matrix-tree定理,主对角线第i行是i的度数,(i,j) 值为i和j之间边的数量,然后删去第一行第一列,利用初等变换求出行列式的绝对值就是答案。 附上代码——by VANE ...
分类:
其他好文 时间:
2017-12-14 03:51:03
阅读次数:
122
载入程序包:‘gmp’ The following objects are masked from ‘package:base’: %*%, apply, crossprod, matrix, tcrossprod ...
分类:
其他好文 时间:
2017-12-13 14:21:27
阅读次数:
222
I don't think this is a hard problem. It is easy to figure out the walk pattern. Anyway...Walk patterns: If out of bottom border (row >= m) then row = ...
分类:
其他好文 时间:
2017-12-13 02:02:38
阅读次数:
157
Let's play the minesweeper game (Wikipedia, online game)! You are given a 2D char matrix representing the game board. 'M' represents an unrevealed min... ...
分类:
其他好文 时间:
2017-12-12 00:05:28
阅读次数:
322
这一节课讲解了被称为独立系统的一类问题,以及用贪心解决独立系统问题的近似比。 ...
分类:
其他好文 时间:
2017-12-12 00:05:10
阅读次数:
210
Description: Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row ...
分类:
其他好文 时间:
2017-12-11 23:07:19
阅读次数:
148
```cpp include include using namespace std; typedef long long ll; ll k; const ll mod=1e9+7; struct Matrix{ int n; ll num[105][105]; Matrix operator (c ...
分类:
其他好文 时间:
2017-12-11 14:27:10
阅读次数:
119
矩阵BSGS,同样处理即可。 有一个优化可以更快,判断矩阵相等可以$O(n)$。列矩阵的使用。 c++ include using namespace std; typedef long long ll; const int N=71; int n,m,P; struct matrix{ int a ...
分类:
其他好文 时间:
2017-12-11 14:20:16
阅读次数:
182
InputThe input consists of a sequence of matrix specifications. Each matrix specification consists of the rowand column dimensions in that order on a ...
分类:
其他好文 时间:
2017-12-10 15:58:41
阅读次数:
151
"我是链接" 这道题做着的思路还是很不容易的,不看题解不会真的去写二项式展开。 首先求出0~50以内的C(n , m),然后我们又根据二项式定理,知道 $$ (x + 1) ^2 = \sum_{i =0}^n C(n , i) x^i $$ (个人习惯写法的二项式定理qwq) 所以要推出 $T_n ...
分类:
其他好文 时间:
2017-12-09 15:50:50
阅读次数:
183