알고리즘/백준(BOJ)

#include #include #include using namespace std; int main(){ int T; scanf("%d", &T); for(int i = 0; i > x >> y; long long move, max = 0; while(max * max
#include #include #include #include using namespace std; int dp[31][31]; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); for (int i = 1; i t; while (t--) { int n, m; cin >> n >> m; cout
DFS 는 stack 또는 recursive 함수를 사용하여 푼다. BFS 는 queue를 사용하여 푼다. #include #include #include #include #include #include using namespace std; // dfs에 들어오면 '방문'한 것으로 판단 // 해당 위치에 check true 로 해준다. void dfs(int start, vector graph[], bool check[]){ stack s; s.push(start); check[start] = true; printf("%d ", start); while(!s.empty()){ int current_node = s.top(); s.pop(); for(int i = 0; i < graph[current_no..
#include struct CELL{ int s, d, z; }; int r, c, m; CELL map[2][100][100]; int fishing(int cur, int pos){ int size = 0; for(int y = 0; y up // 2 -> down // 3 -> right // 4 -> down void move(int cur){ int next = (cur + 1) % 2; ..
오뚜깅
'알고리즘/백준(BOJ)' 카테고리의 글 목록 (4 Page)