13460.cpp - 구슬 탈출 2
#include #include using namespace std; struct step { int ry, rx; //빨간공 int by, bx; //파란공 int cnt; //카운트 }; //graph, visited 준비 char graph[11][11]; bool visited[11][11][11][11]; // n, m 준비 int n, m; // dy, dx 준비 int dy[4] = {1,-1,0,0}; int dx[4] = {0,0,1,-1}; // move: graph 내 #이나 O를 만날 때까지 이동 void move(int& ny, int& nx, int& distance, int& i) { while (graph[ny+dy[i]][nx+dx[i]]!='#' && graph[ny][n..
2023. 10. 10.