棋盤覆蓋問題

2021-05-24 12:09:42 字數 892 閱讀 7211

source code:

#include

#include

#include

using namespace std;

const int n=1024;

int board[n][n],count;

void cover(int sx,int sy,int cx,int cy,int size,int cx1,int cy1)

else if(cx=midy)

else if(cx>=midx&&cy

else

count++; }

void tileboard(int sx,int sy,int cx,int cy,int size)

void print(int n)

printf("/n"); }

int main()

return 0; }

測試:

為簡化**,我假定你的輸入是正確的!輸入以0,

0,0結束。

請輸入起點座標:

0 0

請輸入棋盤大小:2

answer:

-10 00

請輸入起點座標:

3 3

請輸入棋盤大小:4

answer:

1122

1002

3044

334 -1

請輸入起點座標:

0 0

請輸入棋盤大小:0

process returned 0 (0x0)execution time : 26.531 s

press any key to continue.

棋盤覆蓋問題

問題 在乙個2k 2k k 0 個方格組成的棋盤中,恰有乙個方格與其他方格不同,稱該方格為特殊方格。顯然,特殊方格在棋盤中可能出現的位置有4k種,因而有4k種不同的棋盤,圖4.10 a 所示是k 2時16種棋盤中的乙個。棋盤覆蓋問題 chess cover problem 要求用圖4.10 b 所示...

棋盤覆蓋問題

棋盤覆蓋問題 time limit 1000ms,special time limit 2500ms,memory limit 32768kb total submit users 103,accepted users 40 problem 10432 no special judgement pr...

棋盤覆蓋問題

author tanky woo blog www.wutianqi.com 棋盤覆蓋問題 分治法2010 12 3 include using namespace std const int n 11 int board n n int tile 0 tr 棋盤左上角方格的行號 tc 棋盤左上角方...