알고스팟(69)
-
[Brute-force]BOARDCOVER 게임판 덮기
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 #include bool gameboard[20][20] = {false, }; // y1, x1, y2, x2 int block[4][4] = { {1,-1, 1, 0}, {1, 0, 1, 1}, {1, 0, 0, 1}, {0, 1, 1, 1} }; bool isOkay(int h, int w, int y, int x) { re..
2020.12.30 -
[Brute-force] PICNIC 피크닉
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 #include #include #include int picnic(std::vector& friendPairList, bool* isInclude, int studentNum, int index, int includeCount) { int ret = 0, first = 0, second = 0; if(includeCount == studentNum) return 1; if(index == friendPairList.size()) return 0; first =..
2020.12.29 -
[Brute-force, Dynamic] 보글 게임
brute-force 핵심함수 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 const int dx[8] = { -1, -1, -1, 1, 1, 1, 0, 0}; const int dy[8] = { -1, 0, 1, -1, 0, 1, -1, 1}; bool hasWord(int y, int x, const string& word) { if(!inRange(y,x)) return false; if(board[y][x] != word[0]) return false; if(word.size() == 1) return true; for(int direction = 0; direction 3으로 표현하여 size()가 가장 작은 알파벳으로 분할하면 더 빨리 풀 수 있을 것이다. - 3..
2020.12.28