价值可以为0真恶心
瞧不起
#include<bits/stdc++.h>
using namespace std;
int n, m, k;
const int N = 60, M = 20, MOD = 1000000007;
long long f[N][N][M][M];
int w[N][N];
int main()
{
cin >> n >> m >> k;
for(int i = 1; i <= n; i ++) for(int j = 1; j <= m; j ++) cin >> w[i][j], w[i][j] ++;
f[1][1][0][0] = 1;
f[1][1][1][w[1][1]] = 1;
for(int i = 1; i <= n; i ++)
for(int j = 1; j <= m; j ++)
{
if(i == j && j == 1) continue;
for(int u = 0; u <= k; u ++)
{
for(int v = 0; v <= 13; v ++)
f[i][j][u][v] = (f[i-1][j][u][v] + f[i][j-1][u][v]) % MOD;
if(!u) continue;
for(int t = 0; t < w[i][j]; t ++)
f[i][j][u][w[i][j]] = (f[i][j][u][w[i][j]] + f[i-1][j][u-1][t]) % MOD,
f[i][j][u][w[i][j]] = (f[i][j][u][w[i][j]] + f[i][j-1][u-1][t]) % MOD;
}
}
int res = 0;
for(int i = 1; i <= 13; i ++) res = (res + f[n][m][k][i]) % MOD;
cout << res;
}