C++(씨쁠쁠)(cplusplus)-백준(baekjoon)(BaekJoon)코딩 2667번:단지번호붙이기(DFS) 답
DFS로 푼 정답 입니다 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263#include #include using namespace std;int c[1000], a[26][26], d[26][26], N, cnt, dx[4] = { 0,0,1,-1 }, dy[4] = { 1,-1,0,0 };int compare(const void *a, const void *b){ return *(int*)a - *(int*)b;}void DFS(int i,int j, int cnt){ d[i][j] = 1; d[i][j] = cnt; { for(int k ..
C++(씨쁠쁠)(cplusplus)-백준(baekjoon)(BaekJoon)코딩 2667번:단지번호붙이기(BFS) 답
BFS로 푼 답 입니다 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273#include #include #include using namespace std; int c[1000], a[26][26], d[26][26], N, cnt, dx[4] = { 0,0,1,-1 }, dy[4] = { 1,-1,0,0 };int compare(const void *a, const void *b){ return *(int*)a - *(int*)b;}void BFS(int i,int j, int cnt){ queue q; q...