2024/07/22 3

[Python][백준] 1449. 수리공 항승 / 정렬,그리디(S3)

링크🔗https://www.acmicpc.net/problem/1449🗒️파이썬 코드 풀이N,L = map(int,input().split())lst = list(map(int,input().split()))lst.sort()start = lst[0]-1end = start + L count = 1for i in range(N): if lst[i]  1. 입력받은 lst를 정렬 해준다. 2. Start와 end의 범위를 만들어주고, 범위를 갱신하는 방향으로 간다. 3. 반복문에서 lst[i]가 Start와 end의 범위 내외면 continue,lst[i]가 Start와 end의 범위 밖이면 범위 초기화 및 count + 1   🗒️내 풀이 코드from collections import dequ..

[Python][백준] 7562. 나이트의 이동/ BFS,그래프 탐색(S1)

링크🔗https://www.acmicpc.net/problem/7562🗒️파이썬 코드 풀이from collections import dequeT = int(input())for _ in range(T): I = int(input()) start_x,start_y = list(map(int,input().split())) end_x,end_y = list(map(int,input().split())) chess = [[-1]*I for _ in range(I)] nights = [[-2,-1],[-2,1],[2,1],[2,-1],[-1,2],[1,2],[-1,-2],[1,-2]] def dfs(i,j): q = deque([[i,j]]) ches..