{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"Place chess pieces on a chessboard with a given shape (which may be irregular). The chess pieces are indistinguishable. It is required that any two chess pieces cannot be placed in the same row or column on the chessboard. Please write a program to calculate the number of feasible placement arrangements C for a given shape and size of the chessboard with k chess pieces."}},{"title":"Input","value":{"format":"HTML","content":"The input contains multiple test cases.\r\u003cbr\u003eFor each test case, the first line contains two positive integers, n and k, separated by a space, indicating that a n*n matrix will be used to describe the chessboard and the number of chess pieces to be placed. n \u0026lt;\u003d 8, k \u0026lt;\u003d n\r\u003cbr\u003eWhen n and k are both -1, it indicates the end of input.\r\u003cbr\u003eThe following n lines describe the shape of the chessboard: each line contains n characters, where # represents a chessboard area and . represents a blank area (the data ensures that there are no extra blank lines or columns)."}},{"title":"Output","value":{"format":"HTML","content":"For each test case, output a line containing the number of placement arrangements C (the data guarantees that C\u0026lt;2^31)."}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e2 1\r\n#.\r\n.#\r\n4 4\r\n...#\r\n..#.\r\n.#..\r\n#...\r\n-1 -1\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2\r\n1\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}}]}