일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- JavaScript
- softeer
- heapq
- Baekjoon
- programmers
- re_lunchu
- 스마트팩토리
- cs공부
- boj
- 현대
- Java
- 파이썬
- 현대자동차
- alogorithm
- cim
- Python
- 백준
- 티스토리챌린지
- 알고리즘
- 프로그래머스
- 자바
- 오블완
- 소프티어
- Algorithm
- 힙큐
- 탐욕법
- GAN
- 딥러닝
- 자바스크립트
- 토이프로젝트
- Today
- Total
목록boj (6)
eaz_coding
문제https://www.acmicpc.net/problem/11660 풀이import sysinput = sys.stdin.readlinen, m = map(int, input().split())arr = [list(map(int, input().split())) for _ in range(n)]dp = [[0 for _ in range(n+1)] for _ in range(n+1)]for i in range(1, n+1): for j in range(1, n+1): dp[i][j] = arr[i-1][j-1] + dp[i-1][j] + dp[i][j-1] - dp[i-1][j-1]for _ in range(m): x1, y1, x2, y2 = map(int, input().sp..
문제https://www.acmicpc.net/problem/1167 풀이지난번에 풀었던 1967번 트리의 지름을 그대로 이용한 문제 풀이다.트리의 지름은 하나의 공식처럼 이해하면 좋을 것 같다. 1. 루트 노드에서 각 노드까지 최소 거리를 구한다. 2. 최소 거리가 가장 먼 노드에서 가장 먼 거리를 구한다.import sysinput = sys.stdin.readlinefrom collections import dequev = int(input())nodes = [[] for _ in range(v+1)]for _ in range(v): q = deque(list(map(int, input().split()))) x = q.popleft() while q: y =..
문제https://www.acmicpc.net/problem/9019 풀이오답에서 놓쳤던 부분들1. L과 R에서 이동할때, str로 변경하지 않고 몫과 나머지로 계산해서 구할 수 있다.2. visited를 딕셔너리로 하는 것보다 리스트로 만들어서 인덱싱 하는 것이 더 빠르다.3. visited를 통해 더 적은 수로 미리 만들어진 곳은 큐에 추가하지 않는다. import sysinput = sys.stdin.readlinefrom collections import dequet = int(input())for _ in range(t): visited = [False for _ in range(10001)] a, b = map(int, input().split()) q = deque() q.appe..
문제https://www.acmicpc.net/problem/17144 풀이import sysinput = sys.stdin.readliner, c, time = map(int, input().split())arr = []purifier = []for i in range(r): arr.append(list(map(int, input().split()))) for j in range(c): if arr[i][j] == -1: purifier.append((i, j))directions = [(0, 1), (1, 0), (0, -1), (-1, 0)]opposite = [(0, 1), (-1, 0), (0, -1), (1, 0)]def area(x, y): ..
문제https://www.acmicpc.net/problem/14891 풀이import sysinput = sys.stdin.readlinewheel = [list(input().strip()) for _ in range(4)]k = int(input())def check(now, i, directions): if i == 2: if now 0 and wheel[now][i] != wheel[now-1][2]: directions[now-1] = -directions[now] directions = check(now-1, i, directions) return directionsdef move(before, direction): res..
문제세준이는 크기가 N×N인 배열 A를 만들었다. 배열에 들어있는 수 A[i][j] = i×j 이다. 이 수를 일차원 배열 B에 넣으면 B의 크기는 N×N이 된다. B를 오름차순 정렬했을 때, B[k]를 구해보자.배열 A와 B의 인덱스는 1부터 시작한다. https://www.acmicpc.net/problem/1300 풀이import sysinput = sys.stdin.readlinen = int(input())k = int(input())s, e = 1, kanswer = 0while s = k: answer = m e = m-1 else: s = m+1print(answer)