You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
#include <bits/stdc++.h>
|
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
int n, k, vis[15], ans;
|
|
|
|
|
char mat[15][15];
|
|
|
|
|
|
|
|
|
|
//cur : <20><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
//num : <20>Ѿ<EFBFBD><D1BE>ڷŵ<DAB7><C5B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void dfs(int cur, int num) {
|
|
|
|
|
if (num == k) {
|
|
|
|
|
ans++;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (int i = cur; i < n; i++) {
|
|
|
|
|
for (int j = 0; j < n; j++) {
|
|
|
|
|
if (mat[i][j] == '#' && !vis[j]) {
|
|
|
|
|
vis[j] = 1;
|
|
|
|
|
dfs(i + 1, num + 1);
|
|
|
|
|
vis[j] = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
|
while (~scanf("%d %d%*c", &n, &k) && n != -1 && k != -1) {
|
|
|
|
|
memset(vis, 0, sizeof(vis));
|
|
|
|
|
int i;
|
|
|
|
|
for (i = 0; i < n; i++)
|
|
|
|
|
gets(mat[i]);
|
|
|
|
|
|
|
|
|
|
ans = 0;
|
|
|
|
|
dfs(0, 0);
|
|
|
|
|
printf("%d\n", ans);
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|