[Offer收割]编程练习赛23 register

Ended

Participants:430

Verdict:Accepted
Score:100 / 100
Submitted:2017-08-20 13:03:39

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//#define DEBUG
//#define PROBLEM
//#define MY
#include <bits/stdc++.h>
#define mt(a, b) memset(a, b, sizeof(a))
using namespace std;
typedef long long LL;
const double PI = acos(-1.0);
const double EPS = 1e-8;
const LL MOD = 1e9 + 7;
const int M = 1e2 + 10;
class Matrix { ///
    typedef LL typev;///
    static const int MV=10;///
    static const LL mod=MOD;///%mod
    friend Matrix operator *(const Matrix &a,const Matrix &b) { ///ab
        Matrix ret;
        ret.n=a.n;
        ret.m=b.m;
        ret.zero();
        if(a.m==b.n) {
            for(int k=0; k<a.m; k++) {
                for(int i=0; i<a.n; i++) {
                    if(a.val[i][k]) {
                        for(int j=0; j<b.m; j++) {
                            ret.val[i][j]+=a.val[i][k]*b.val[k][j];
                            ret.val[i][j]%=mod;///
                        }
                    }
                }
            }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX