POJ 1321 棋盤問題

2021-06-28 12:23:43 字數 760 閱讀 8837

#include#includeint check(int a,int m)

if(b==m)

return 1;

return 0;

}int main()

if(n==-1&&m==-1)

break;

for(int i=0; iscanf("%s",map[i]);

memset(map1,0,sizeof(map1));

for(int i=0; ilen=0;

for(int i=0; i<(1

s[len++]=i;

memset(dp,0,sizeof(dp));

for(int j=0;jfor(int i=1; i}

for(int i=0;iint ans=0;

for(int i=0; ians+=dp[s[i]][n-1];

printf("%d\n",ans);

}return 0;}/*

4 3#..#

#.#.

..#.

#.##

5 4#..#.

#.#..

..#..

#.##.

.####

3 3###

######

*//*

5 4#.#.

##..

.#..

###.

.###

*/

POJ 1321 棋盤問題

time limit 1000ms memory limit 10000k total submissions 7007 accepted 3390 description 在乙個給定形狀的棋盤 形狀可能是不規則的 上面擺放棋子,棋子沒有區別。要求擺放時任意的兩個棋子不能放在棋盤中的同一行或者同一列...

poj 1321 棋盤問題

棋盤問題 time limit 1000ms memory limit 10000k total submissions 15365 accepted 7600 description 在乙個給定形狀的棋盤 形狀可能是不規則的 上面擺放棋子,棋子沒有區別。要求擺放時任意的兩個棋子不能放在棋盤中的同一...

POJ 1321 棋盤問題

找到第乙個有 的行開始回溯就可以了 include include using namespace std const int maxn 9 char board maxn maxn bool c maxn int ans,n,k void backtracking int curi,int cnt...