[백준] 2606번 바이러스 (C)
출처 2004 전국 본선 초등3 힌트 단순 탐색 풀이 양방향 그래프를 만들어 준 뒤, 연결 되어 있는 컴퓨터들을 찾아가면 됩니다. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 #include using namespace std; int com[101][101]; int check[101]; int ans=-1; int v,e; void dfs(int n){ check[n]=1; ans++; for(int i=1;i>v>>e; for(int i=0;i>a>>b; com[a][b]=1; com[b][a]=1; } int n; dfs(1); cout