Notice
Recent Posts
Recent Comments
Link
목록2606번 (1)
궤도
[백준] 2606번 : 바이러스
문제 풀이 DFS 또는 BFS로 정점 1과 연결된 정점의 수를 세면 된다. 난 그냥 편하게 DFS를 재귀함수로 구현했다. 소스코드 #include using namespace std; int matrix[101][101], cnt; bool visited[101] = {false}; //정점의 방문 여부 void dfs(int cur, int max) { //재귀함수로 구현 for (int i = 1; i > N >> M; for (int i = 0; i > first >> second; matrix[first][second] = 1; matrix[second][first] = 1; } visited[1] = true; dfs(1, N); cout
💻 현생/⛓ 알고리즘
2021. 4. 5. 20:07