방문 길이 C++
#include #include using namespace std; const int MAX = 12; int visited[MAX][MAX][MAX][MAX]; struct Move { int x, y; }; Move mv[4] = { {0,1}, {0,-1}, {1,0}, {-1,0} };//U, D, R, L int solution(string dirs) { int answer = 0; memset(visited, -1, sizeof(visited)); int currenti = 5, currentj = 5; for (int i = 0; i < dirs.size(); i++) { int movei, movej; if (dirs[i] == 'U') { movei = currenti + mv[0].x..
2019. 10. 23.