본문 바로가기
  • KEEP HUSTLE!

전체 글73

[백준 2206] 벽 부수고 이동하기 - Python(파이썬) import sys def solution(): my_d = [(0, 0, 1)] check[0][0] = 1 ans = 1 while my_d: temp = [] for x, y, crush in my_d: if x == N-1 and y == M-1: return ans for i in range(4): new_x, new_y = x + dx[i], y + dy[i] if 0 2021. 2. 22.
[백준 10816] 숫자 카드 2 - Python(파이썬) from collections import Counter import sys N = int(sys.stdin.readline().strip()) N_data = sorted(map(int, sys.stdin.readline().split())) M = int(sys.stdin.readline().strip()) M_data = list(map(int, sys.stdin.readline().split())) result = Counter(N_data) for m in M_data: print(result[m], end=' ') 2021. 2. 20.
[백준 1654] 랜선 자르기 - Python(파이썬) import sys K, N = map(int, sys.stdin.readline().split()) lines = [] for k in range(K): data = int(sys.stdin.readline().strip()) lines.append(data) start, end = 1, max(lines) while start = N: break if cnt >= N: start = mid + 1 else: end = mid - 1 print(end) 2021. 2. 20.
[백준 1920] 수 찾기 - Python(파이썬) from bisect import bisect import sys N = int(sys.stdin.readline().strip()) A = list(map(int, sys.stdin.readline().split())) M = int(sys.stdin.readline().strip()) M_data = list(map(int, sys.stdin.readline().split())) A.sort() for m in M_data: i = bisect(A, m) - 1 if i != len(A) and A[i] == m: print(1) else: print(0) 2021. 2. 20.
[백준 2110] 공유기 설치 - Python(파이썬) import sys N, C = map(int, sys.stdin.readline().split()) houses = [] for n in range(N): houses.append(int(sys.stdin.readline().strip())) houses.sort() start, end = 1, houses[-1] - houses[0] ans = 0 while start = x + gap: cnt += 1 x = houses[i] if cnt >= C: start = gap + 1 ans = gap else: end = gap - 1 print(ans) 2021. 2. 20.
[HacKerRank SQL] New Companies- MYSQL 그냥 풀기 SELECT C.company_code, C.founder, COUNT(DISTINCT L.lead_manager_code), COUNT(DISTINCT S.senior_manager_code), COUNT(DISTINCT M.manager_code), COUNT(DISTINCT E.employee_code) FROM Company AS C, Lead_Manager AS L, Senior_Manager AS S, Manager AS M, Employee AS E WHERE C.company_code = L.company_code AND L.lead_manager_code = S.lead_manager_code AND S.senior_manager_code = M.senior_manager_co.. 2021. 2. 19.