본문 바로가기

Python26

[백준/14503/파이썬] 로봇 청소기 (Python,구현) [백준/파이썬] 14503번 : 로봇 청소기 (Python,구현) 14503번: 로봇 청소기 (acmicpc.net) 코드 # https://www.acmicpc.net/problem/14503 from sys import stdin n, m = map(int,stdin.readline().split()) ## 행 , 열 y, x, d = map(int, stdin.readline().split()) ## 처음 위치 (x,y), 방향 arr =[] for i in range(n): arr_temp = list(map(int,stdin.readline().split())) arr.append(arr_temp) # a = arr[y][x] # print(a) # d 방향 # if d == 0: #북쪽 # p.. 2023. 4. 13.
[백준/2468/파이썬] 안전 영역 (Python, dfs) [백준/2468/파이썬] 안전 영역 (Python, dfs) 2468번: 안전 영역 (acmicpc.net) 코드 1 (함수 x) from sys import stdin,setrecursionlimit import copy # 복사 input = stdin.readline # 변수 정의 depth_arr = [] # 입력 깊이 배열 depth_arr2 = [] # 비교할 입력 길이 safe_arr = [] # 안전지대 개수 depth_max = 0 # 최대 깊이 depth = 4 # 입력 N = int(input()) #재귀 깊이 늘리기 setrecursionlimit(N*N+10) # array 추가 for i in range(N): depth_arr.append(list(map(int, input().. 2023. 3. 17.
[백준/24483/파이썬] 알고리즘 수업 - 깊이 우선 탐색 5 (dfs,Python) [백준/24483/파이썬] 알고리즘 수업 - 깊이 우선 탐색 5 (dfs,Python) 24483번: 알고리즘 수업 - 깊이 우선 탐색 5 (acmicpc.net) 코드 from sys import stdin,setrecursionlimit input = stdin.readline N, M, R = map(int, input().split()) # 정점, 간선, 시작라인 setrecursionlimit(N+10) # 방문 순서, 깊이 구하기 visited = [-1] * (N+1) #방문 판단 graph = [[]for _ in range(N+1)] #정점 연결 # -- 입력 및 그래프 연결 -- # for _ in range(M): # 간선의 이어진 개수만큼이기 때문에 u, v = map(int, in.. 2023. 3. 15.
[백준/1138/파이썬(Python)] 한 줄로 서기 (구현) [백준/1138/파이썬(Python)] 한 줄로 서기 (구현) 1138번: 한 줄로 서기 (acmicpc.net) 코드 from sys import stdin,setrecursionlimit input = stdin.readline N = int(input()) # 사람의 수 N_list = list(map(int,input().split())) # 왼쪽에 키 큰사람 cm = list(range(1,N+1)) # 1, 2, 3, 4 키순 result = [] j = -1 for i in range(N): result.insert(N_list[j], cm[j]) j -=1 for i in result: print(i , end = ' ') 풀이 이 문제를 풀이해보면 2 1 1 0 예시의 경우 자기보다 키가.. 2023. 3. 14.