IT 62

[SWEA] 2383. 점심 식사시간(python)

계단마다 사람을 배치하는 것은 모든 경우의 수를 다 고려했다. 계단과 사람과의 거리를 나타내는 배열 order, 계단입구를 나타내는 배열 entry, 계단을 내려가는 횟수를 기록하는 배열 down을 만들어 구현하였다. from itertools import combinations T = int(input()) def downTo(people,stair): order,down,entry=[],[],[] stairSize=stair[2] for person in people: order.append(abs(stair[0]-person[0])+abs(stair[1]-person[1])) order.sort() time=0 while order: time+=1 while entry and len(down)

IT/coding study 2022.09.16

[acmicpc] 14891. 톱니바퀴(python)

시뮬레이션 import sys from collections import deque input=sys.stdin.readline wheels=[[]] for i in range(4): wheels.append(deque(list(input().strip()))) K=int(input()) for i in range(K): num, dir=map(int,input().split()) moves = [0] * 5 # 회전할 톱니바퀴 방향 체크 moves[num] = dir left=wheels[num][6] for j in range(num-1,0,-1): # 맨왼쪽까지 비교 if wheels[j][2]==left: break # 극이 같으면 stop moves[j]=-moves[j+1] left=wheel..

IT/coding study 2022.09.01