#include <cstdio>#include <cstring>#define MOD 1000000007int dp[55][55][15][15];int val[55][55];int main(){ int n, m, k; scanf("%d %d %d", &n, &m, &k); for(int i = 1; i <= n; i++) { for(int j = 1; j <= m; j++) { scanf("%d", &val[i][j]); val[i][j] ++; } } memset(dp, 0, sizeof(dp)); dp[1][1][val[1][1]][1] = 1; dp[1][1][0][0] = 1; for(int i = 1; i <= n; i++) { for(int j = 1; j <= m; j++) { if(i == 1 && j == 1) continue; for(int num = 0; num <= k; num++) { for(int ma = 0; ma <= 13; ma++) { if(ma < val[i][j]) { dp[i][j][val[i][j]][num + 1] = (dp[i][j][val[i][j]][num + 1] + dp[i - 1][j][ma][num]) % MOD; dp[i][j][val[i][j]][num + 1] = (dp[i][j][val[i][j]][num + 1] + dp[i][j - 1][ma][num]) % MOD; } dp[i][j][ma][num] = (dp[i][j][ma][num] + dp[i - 1][j][ma][num]) % MOD; dp[i][j][ma][num] = (dp[i][j][ma][num] + dp[i][j - 1][ma][num]) % MOD; } } } } int ans = 0; for(int i = 0; i < 13; i++) ans = (ans + dp[n][m][i][k]) % MOD; PRintf("%d/n", ans);}
新闻热点
疑难解答