第一次用剪枝

2021-06-14 20:38:47 字數 766 閱讀 4923

hdoj 1010

#include #include using namespace std;

int n, m, t, sx, sy, ex, ey;

char maze[8][8];

int dir[4][2] = , , , };

bool escape = false;

int least_distance(int x, int y)

void dfs(int x, int y, int step)

if (escape)

return;

int temp = (t - step) - least_distance(x, y);

if (temp < 0 || temp % 2 == 1)

return;

for (int i = 0; i < 4; ++i)

}}int main()

if(maze[i][j] == 'd')

if(maze[i][j] == 'x')

}getchar();

// printf("\n");

}if(m * n - wall <= t)

maze[sx][sy] = 'x';

dfs(sx, sy, 0);

if(escape)

printf("yes\n");

else

printf("no\n");

}return 0;

}

第一次用部落格

這是乙個開始 你好!這是你第一次使用markdown編輯器所展示的歡迎頁。如果你想學習如何使用markdown編輯器,可以仔細閱讀這篇文章,了解一下markdown的基本語法知識。全新的介面設計,將會帶來全新的寫作體驗 在創作中心設定你喜愛的 高亮樣式,markdown將 片顯示選擇的高亮樣式進行展...

第一次用ActionScript

以前以為做網路程式設計就是好asp就好,但是後面漸漸的開始轉型asp.net了,又漸漸的轉到了php上,在這其中各種script的語言給我們的東西填色不少,如今漸漸地開始接觸到了一些東西,需要使用flash了,那就開始我的actionscript了。今天開始寫我的學習actionscript,今天的...

第一次用結構體

e 百步穿楊 time limit 1000msmemory limit 32768kb64bit io format i64d i64u submit status practice hdu 2550 description 時維九月,序屬三秋,遼軍大舉進攻mca山,戰場上兩軍正交鋒.遼軍統帥是名...