N으로 표현
#include #include #include using namespace std; int answer = 9; void dfs(int n, int count, int num, int number) { if (count > 8) return; if (num == number) { answer = min(answer,count); return; } int index = 0; for (int i = 0; i < 8; i++) { index = index * 10 + n; dfs(n, count + 1 + i, num + index, number); dfs(n, count + 1 + i, num - index, number); dfs(n, count + 1 + i, num * index, number); d..
2019. 9. 10.
카카오프렌즈 컬러링북
#include #include #include using namespace std; const int MAX = 101; int visited[MAX][MAX]; vector map; int M, N; struct Move { int x, y; }; Move mv[4] = { {1,0}, {-1,0}, {0,1}, {0,-1} }; int dfs(int i, int j,int count) { visited[i][j] = 1; for (int k = 0; k = 0 && movei = 0 && movej < N) { if (visited[movei][..
2019. 9. 10.