일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 스택
- Network
- 에라토스테네스의 체
- dfs
- 시뮬레이션
- 그리디
- 프로그래머스
- java
- mst
- 동적계획법
- Effective Java
- 문자열
- 투 포인터
- 위상정렬
- 구현
- 백트래킹
- BFS
- 백준
- 수학
- 플로이드-와샬
- CS
- 후니의 쉽게 쓴 시스코 네트워킹
- swea
- 세그먼트 트리
- 알고리즘
- 유니온 파인드
- JUnit 5
- Kotlin
- 이분탐색
- 완전탐색
목록구현 (108)
반갑습니다!
프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 풀이 문제에서 요구하는 n진수로의 변환을 구현하면 어렵지 않게 해결할 수 있는 문제이다. 코드C++ #include #include #include using namespace std; const char Hex[] = { 'A', 'B', 'C', 'D', 'E', 'F' }; // n진수로 변환 string dec_to_n(int n, int number) { // 10진수이거나 숫자가 0이면 그대로 리턴 if (number == 0 || n == 10) return to_string(number); st..
5566번: 주사위 게임 www.acmicpc.net 풀이 단순 구현 문제이다. 문제에 명시된 그대로 구현하면 쉽게 해결할 수 있다. 코드 #include #include using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, m; cin >> n >> m; vector board(n + 1); vector dice(m); for (int i = 1; i > board[i]; for (int i = 0; i > dice[i]; int cnt = 0; int cur = 1; while (cur = n) break; cur += board[cur]; } cout
10973번: 이전 순열 www.acmicpc.net 풀이 직접 구현해도 되지만 prev_permutation STL을 사용해서 해결하였다. 코드 #include #include #include using namespace std; int n; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; vector ans(n); bool first = true; for (int i = 0; i > ans[i]; if (i == 0) continue; else if (ans[i] < ans[i - 1]) first = false; } if (first) cout
14425번: 문자열 집합 www.acmicpc.net 풀이 Map 자료구조를 사용해서 쉽게 해결할 수 있는 문제이다. Trie 자료구조를 사용해서도 풀 수 있을 것으로 보인다. 코드 #include #include using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); map map; int n, m; cin >> n >> m; for (int i = 0; i > tmp; map[tmp] = 1; } int ans = 0; for (int i = 0; i > tmp; if (map.count(tmp) > 0) ans++;..
2234번: 성곽 www.acmicpc.net 풀이 상당히 구현할게 많고 까다로운 문제였다. BFS를 사용해서 방을 분리하고, BFS를 한번 더 사용해서 각 방들끼리의 관계를 인접 리스트로 표현했다. 벽을 한개만 부셔도 2개의 방은 합쳐질 수 있으므로 서로 인접해 있는 방 2개의 합이 가장 큰 경우를 찾아주었다. 코드 #include #include #include #include #include using namespace std; int m, n; bool can_left, can_up, can_right, can_down; int map[51][51]; int area[51][51]; bool chk[51][51]; vector v; vector adj; const int dx[] = { -1, 0..