일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 백트래킹
- 알고리즘
- 에라토스테네스의 체
- Kotlin
- 세그먼트 트리
- 후니의 쉽게 쓴 시스코 네트워킹
- 동적계획법
- 스택
- CS
- Effective Java
- 구현
- 완전탐색
- BFS
- 투 포인터
- 수학
- 그리디
- 프로그래머스
- mst
- 이분탐색
- 위상정렬
- 문자열
- JUnit 5
- swea
- dfs
- Network
- 시뮬레이션
- java
- 유니온 파인드
- 백준
- 플로이드-와샬
목록전체 글 (291)
반갑습니다!
17837번: 새로운 게임 2 www.acmicpc.net 풀이 새로운 게임과 거의 유사한 문제이다. 새로운 게임에서는 맨 아래에 있는 말만 움직일 수 있었지만, 이번엔 모든 말이 움직일 수 있다. 기본적인 구현은 새로운 게임과 유사하게 구현하여 해결하였고, 다른 말 위에 올라가있는 말을 이동하는 부분은 iterator를 사용하여 구현하였다. #코드 #include #include #include using namespace std; struct Knight { int x, y, dir; }k[11]; int N, K; int map[13][13]; vector list[13][13]; const int dx[] = { 0, 1, -1, 0, 0 }, dy[] = { 0, 0, 0, -1, 1 }, ba..
17780번: 새로운 게임 www.acmicpc.net 풀이 체스판을 배열로 구현하고, 각 칸을 vector를 사용하여 맨 아래에 있는 말부터 차례로 쌓이도록 구현하여 해결하였다. 코드 #include #include #include using namespace std; struct Knight { int x, y, dir; bool canMove; }k[11]; int N, K; int map[13][13]; vector list[13][13]; const int dx[] = { 0, 1, -1, 0, 0 }, dy[] = { 0, 0, 0, -1, 1 }, back[] = { 0, 2, 1, 4, 3 }; int moveKnight(int idx) { int nx = k[idx].x + dx[k[id..
3568번: iSharp www.acmicpc.net 풀이 stringstream을 사용하여 문자열을 분리하고, 분리된 문자열을 뒤에서부터 탐색하여 해결하였다. 코드 #include #include using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); string str; getline(cin, str); stringstream ss(str); string type; string variable; ss >> type; while (ss >> variable) { cout = 0; i--) { char c = variable[i]; if (c == ']') { cout
15654번: N과 M (5) www.acmicpc.net 풀이 백트래킹을 사용해서 순열을 구해주면 되는데, 이 때 숫자 배열은 정렬된 상태여야한다. 코드 #include #include #include using namespace std; int n, m; int num[8]; bool chk[8]; vector ans; void dfs(int idx, int cnt) { if (cnt == m) { for (int i : ans) cout > m; for (int i = 0; i > num[i]; sort(num, num + n); dfs(-1, 0); return 0; }
SW Expert Academy SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요! swexpertacademy.com 풀이 백트래킹을 통해서 해결하였다. 모든 점을 다 탐색하어 최장 길이를 구할 수 있다. 코드 #include #include using namespace std; int n, m, ans; bool adj[11][11]; bool visited[11]; void dfs(int idx, int cnt) { ans = ans > cnt ? ans : cnt; visited[idx] = true; for (int i = 1; i > t; for (int c = 1; c > n >> m; memset(adj, false, sizeof(adj)); memset(visite..