[C++] STL - 변경 알고리즘 함수 (copy, swap, transform, next_permutation)
변경 알고리즘 함수는 컨테이너를 변경하지 않으며, 컨테이너의 지정된 범위에서 요소의 값만을 변경할 수 있는 함수이다. STL에서 제공하는 대표적인 변경 알고리즘 함수에는 copy(), swap(), transform()이 있다. copy() #include template OutputIt copy(InputIt first, InputIt last, OutputIt d_first); first부터 last 전까지의 모든 원소들을 d_first부터 시작하는 곳에 복사한다. swap(), swap_range() #include template void swap (T& a, T& b) swap의 경우 해당 변수에 있는 값들을 서로 바꿔주는 역할을 한다. #include template< class Forward..
[BOJ] 2178번 미로 탐색 (C++)
https://www.acmicpc.net/problem/2178 2178번: 미로 탐색 첫째 줄에 두 정수 N, M(2 ≤ N, M ≤ 100)이 주어진다. 다음 N개의 줄에는 M개의 정수로 미로가 주어진다. 각각의 수들은 붙어서 입력으로 주어진다. www.acmicpc.net #include #include using namespace std; char map[101][101]; int check[101][101]; bool visit[101][101]; int n, m; int dx[4] = { -1, 0, 1, 0 }; int dy[4] = { 0, -1, 0, 1 }; void bfs() { visit[0][0] = true; int cx, cy, ax, ay; queue q; q.push({ ..