전체 글96 [Python] 백준 2667번 : 단지번호붙이기 https://www.acmicpc.net/problem/2667 대각선상에 집이 있는 경우는 연결된 것이 아니다 == 상하좌우 확인 DFSimport sysN = int(sys.stdin.readline().rstrip())graph = [ list(map(int,sys.stdin.readline().rstrip())) for _ in range(N)]result = []cnt = 0def dfs(x, y): global cnt if x = N or y = N: return False if graph[x][y] == 1: cnt += 1 graph[x][y] = 0 dfs(x-1,y) dfs(x+1,y) .. 2024. 9. 9. [Python] 백준 2606번 : 바이러스 https://www.acmicpc.net/problem/2606 BFSfrom collections import dequeimport sysN = int(sys.stdin.readline().rstrip())E = int(sys.stdin.readline().rstrip())graph = [[] for i in range(N+1)]visited = [False] * (N+1)for _ in range(E): a, b = map(int, sys.stdin.readline().split()) graph[a].append(b) graph[b].append(a) for i in graph: i.sort()def bfs(visited, graph, start): que.. 2024. 9. 9. [Python] 백준 2178번 : 미로 탐색 https://www.acmicpc.net/problem/2178 import sysfrom collections import dequeinput = sys.stdin.readlinegraph = []N, M = map(int, input().split())for _ in range(N): graph.append(list(map(int, input().rstrip()))) def bfs(x, y): # 이동할 방향 정의 dx = [-1,1,0,0] dy = [0,0,-1,1] queue = deque() queue.append((x,y)) # 큐가 빌 때 까지 반복 while queue: x, y = queue.popl.. 2024. 9. 8. [SQL 고득점 Kit] String, Date : 조건에 맞는 사용자 정보 조회하기 https://school.programmers.co.kr/learn/courses/30/lessons/164670 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr SELECT USER_ID, NICKNAME, CONCAT(CITY,' ',STREET_ADDRESS1,' ',STREET_ADDRESS2) AS 전체주소, CONCAT(SUBSTRING(B.TLNO,1,3),'-',SUBSTRING(B.TLNO,4,4),'-',SUBSTRING(B.TLNO,8,4)) AS 전화번호FROM USED_GOODS_BOARD A LEFT.. 2024. 9. 6. [SQL 고득점 Kit] String, Date : 자동차 대여 기록 별 대여 금액 구하기 https://school.programmers.co.kr/learn/courses/30/lessons/151141 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr 최종 쿼리WITH HISTORY AS( SELECT A.HISTORY_ID, A.CAR_ID, B.DAILY_FEE, (DATEDIFF(A.END_DATE, A.START_DATE) + 1) AS DURATION, CASE WHEN DATEDIFF(A.END_DATE, A.START_DATE) + 1 >= .. 2024. 8. 22. 이전 1 2 3 4 5 6 7 ··· 20 다음