Algorithm
BOJ 1697 숨바꼭질 c++
백준 1697 숨바꼭질 문제 cpp BFS 문제 풀이방식으로 해결. 시작지점을 기준으로 -1 지점, +1 지점, *2 지점인 곳에 1씩 더해가며 답을 찾음. 범위를 벗어나는 경우 (0 미만 혹은 100000이 넘어가는 경우.) continue 를 꼭 해줘야 함. 사진 출처 - img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2FvwJ4M%2FbtqD4xSR4eQ%2FAAAAAAAAAAAAAAAAAAAAAMjt2Ty9J1g6ZUGgQH-D9C-elvzGFt5uapMCNN6Zi7jc%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1753973999%26allow_ip%3D%26allow_referer%3D%26signature%3D1xYGbQQUuc9fMeHZafb9O%252BTlRqk%253D #include using namespace std; int board[200002]; int n, m; int dx[] = {-1, 1, 2}; int main() { ios..
2020. 7. 10. 02:54
최근댓글