일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- Python
- 프로그래머스
- Lv. 0
- SQL
- Baekjoon
- Lv. 3
- LEVEL 2
- 자바스크립트
- 백준
- softeer
- 깊이 우선 탐색
- SQL 고득점 KIT
- Dynamic Programming
- 오블완
- join
- level 3
- Lv. 2
- 티스토리챌린지
- dfs
- Java
- group by
- bfs
- programmers
- javascript
- 너비 우선 탐색
- Lv. 1
- 동적계획법
- 파이썬
- 소프티어
- DP
- Today
- Total
목록알고리즘 (267)
몸과 마음이 건전한 SW 개발자

문제 링크https://www.acmicpc.net/problem/2565정답 코드import sysinput = sys.stdin.readlinen = int(input())lines = sorted([list(map(int, input().split())) for _ in range(n)], key=lambda x:x[1])dp = [1] * nfor i in range(1, n): si, ti = lines[i] for j in range(i): sj, tj = lines[j] if sj 풀이 방법 입력 처리 및 정렬(시작점, 끝점)을 입력받고 끝나는 지점 기준으로 정렬한다.정렬은 그리디 + DP 조합을 활용하기 위한 사전 작업이다.DP 배열 정의 및 초기화dp[..

문제 링크https://www.acmicpc.net/problem/12919정답 코드s = input()t = input()lenS = len(s)lenT = len(t)answer = 0def isIncluded(arr): normarlString = "".join(arr) reversString = "".join(arr[::-1]) return normarlString in t or reversString in tdef dfs(length, arr): global answer if answer: return if length == lenT: string = "".join(arr) if string == t: an..

문제 링크https://www.acmicpc.net/problem/10830정답 코드import sysinput = sys.stdin.readlinen, b = map(int, input().split())matrix = [list(map(int, input().split())) for _ in range(n)]optimization = dict()# matrix의 원소가 1000이하이기 때문에 처음부터 걸러준다.for i in range(n): for j in range(n): matrix[i][j] %= 1000optimization[1] = matrix# cal = calculationdef cal(leftM, rightM): newM = [[0] * n for _ in ra..

문제 링크https://www.acmicpc.net/problem/12865정답 코드import sysinput = sys.stdin.readlinen, k = map(int, input().split())dp = [[0] * (k+1) for _ in range(n+1)]for i in range(1, n+1): w, v = map(int, input().split()) for j in range(1, k+1): if j >= w: dp[i][j] = max(v+dp[i-1][j-w], dp[i-1][j]) else: dp[i][j] = dp[i-1][j]print(dp[n][k])풀이 방법DP 배열의 의미:dp[i][j]dp[..

문제 링크https://www.acmicpc.net/problem/15684내 코드import sysinput = sys.stdin.readlinen, m, h = map(int, input().split())board = [[0] * (n+1) for _ in range(h+1)]for _ in range(m): row, column = map(int, input().split()) board[row][column] = column + 1 board[row][column+1] = columndef check(board, destination): c = destination for r in range(1, h+1): if board[r][c]: ..

문제 링크https://www.codetree.ai/trails/complete/curated-cards/challenge-group-same-word/description Code Tree | Learning to Code with ConfidenceA super-comprehensive, meticulously arranged Coding Learning Curriculum engineered by Algorithm Experts composed of former International Olympiad in Informatics (IOI) medalists.www.codetree.ai정답 코드import sysinput = sys.stdin.readlinen = int(input())words = ..