Determinant
题意是给有一个n-1行n列的矩阵
让我们求去掉任意一列,得到的行列式的值(模1e9+7),也就是n个答案
最坏的做法枚举每一列然后消元,复杂度O(n³*n),显然不太可行
可以这么做,先做一次高斯消元得到一个阶梯矩阵,然后枚举每一列,枚举到第i列,把i+1到n-1列 往上移动一格,即(做一次消元)
x x x x x x x
0 x x x x x x
0 0 x x x x x
0 0 0 x x x x
0 0 0 0 x x x
0 0 0 0 0 x x
如这样,我们当前枚举到第3列时,
x x x x x x x
0 x x x x x x
0 0 x x x x x
0 0 0 x x x x
0 0 0 0 x x x
0 0 0 0 0 x x
把第4到6列向上做一次消元,然后乘一下,
第一次写矩阵变换,有些地方忘了取模结果爆了long long
#include<cmath>
#include<algorithm>
#include<cstring>
#include<string>
#include<set>
#include<map>
#include<time.h>
#include<cstdio>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<iostream>
#include<stdlib.h>
using namespace std;
#define LONG long long
const int INF=0x3f3f3f3f;
const LONG MOD=1e9+