#include<bits/stdc++.h> usingnamespace std; constint MAXN = 55; int n, k; int t, mp[MAXN][MAXN]; int dp[MAXN][MAXN][4][2]; //dp[i j k t]是到i,j,转了k次的方法数量,并且上次是从左/上边的格子转移来的
voidcalc_dp() { memset(dp, 0, sizeof(dp)); dp[1][1][0][0] = dp[1][1][0][1] = 1; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { if (mp[i][j]) for (int k = 0; k <= 3; k++) { dp[i][j][k][0] += dp[i][j - 1][k][0]; dp[i][j][k][1] += dp[i - 1][j][k][1]; if (k != 0 && i != 1 && j != 1) { dp[i][j][k][0] += dp[i][j - 1][k - 1][1]; dp[i][j][k][1] += dp[i - 1][j][k - 1][0]; } } } } } voidinput() { scanf("%d%d", &n, &k); for (int i = 1; i <= n; i++) { char temp[MAXN]; scanf("%s", temp + 1); for (int j = 1; temp[j]; j++) { if (temp[j] == 'H') mp[i][j] = 0; else mp[i][j] = 1; } } }