일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 디자인 패턴
- 프로토타입
- 브릿지 패턴
- 함수형 팩터리
- 프로토타입 중복처리
- 싱글톤 패턴
- 동적 데코레이터
- 팩터리 메서드
- 팩터리
- 컴포지트 빌더
- 컴포지트 패턴
- 데커레이터
- 데커레이터 패턴
- 동적 데커레이터
- 싱글턴
- 흐름식 빌더
- 모던C++디자인패턴
- 프로토타입 패턴
- 단순한 빌더
- 빌더
- 그루비 스타일 빌더
- 추상 팩터리
- 팩터리 패턴
- 브릿지
- 디자인패턴
- 컴포지트
- 싱글톤
- 싱글턴 패턴
- 내부 팩터리
- 빌더 패턴
- Today
- Total
목록Algorithm (22)
GGym's Practice Notes
분류는 그리디라고 되어있는데 최적의 해를 찾기 위해선 브루트포스 방식으로 코드를 짜야하는듯하다. 그리고 백준에도 같은 문제가 있는데 테스트케이스 조건이 더 빡빡해서 이 코드 그대로 썼다가 시간초과가 나서 백준에서는 코드를 수정하여 제출 했다. 백준 문제 : www.acmicpc.net/problem/3663 3663번: 고득점 현수는 조이스틱을 이용해 지렁이를 미로에서 탈출시키는 게임을 하고 있다. 최고 점수를 얻은 경우에는 조이스틱을 이용해서 이름을 입력해야 한다. 이름을 입력하는 과정은 다음과 같다. 가�� www.acmicpc.net #include // Level2_ 조이스틱 [그리디] #include #include #include #define calc(c) c - 'A' < 'Z' - c +..
스킬트리에 들어가 있는 문자를 체크하고 Queue를 이용해 스킬트리의 순서를 검사한다. #include // Level2_ 스킬트리 [큐] #include #include #include #include using namespace std; int solution(string skill, vector skill_trees) { int answer = 0; queue oq; bool is_prior[26]; memset(is_prior, false, sizeof(char)*26); for(auto ch : skill){ oq.push(ch); is_prior[ch-'A'] = true; } for(int i= 0; i>n; cin >> skill; for(int i=0; i> s; skill_trees.p..
단어간에 노드를 만들고 DFS를 이용해 경로를 찾았다. #include // Level3_ 단어 변환 [dfs] #include #include using namespace std; bool visit[52]; bool node[52][52]; int answer = INT_MAX; void dfs(int n, int begin, int target, vector& words){ if(words[begin] == words[target]) { if (answer > n) answer = n; return; } else { for(int i=0; i
Queue와 Pair를 이용해 구현 #include // Level2_ 다리를 지나는 트럭 [큐] #include #include #include using namespace std; int solution(int bridge_length, int weight, vector truck_weights) { int weightSum = truck_weights[0], idx=1, i; queue bridge; bridge.push(make_pair(1, truck_weights[0])); for(i=2;;i++){ if( bridge.front().first + bridge_length == i){ weightSum -= bridge.front().second; bridge.pop(); } if( idx =..