목록0-1 BFS (1)
레야몬
[C++] 13549번 숨바꼭질 3 - 0-1 BFS
#include #include #include #define MAX_LOC 200003 using namespace std; int N, K; //수빈이의 위치, 동생의 위치 vector c(MAX_LOC); //이미 탐색했는지 확인 deque q; //갈 예정인 경로 저장 int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> N >> K; q.push_back(N); c[N]=1; while(!q.empty()) { int n=q.front(); q.pop_front(); //앞에 있는게 우선 if(n==K) break; if(2*n
알고리즘/백준
2022. 9. 6. 02:55