enumerate(2)
-
프로그래머스_모의고사_python
https://programmers.co.kr/learn/courses/30/lessons/42840 코딩테스트 연습 - 모의고사 수포자는 수학을 포기한 사람의 준말입니다. 수포자 삼인방은 모의고사에 수학 문제를 전부 찍으려 합니다. 수포자는 1번 문제부터 마지막 문제까지 다음과 같이 찍습니다. 1번 수포자가 찍는 programmers.co.kr 수포자는 수학을 포기한 사람의 준말입니다. 수포자 삼인방은 모의고사에 수학 문제를 전부 찍으려 합니다. 수포자는 1번 문제부터 마지막 문제까지 다음과 같이 찍습니다. 1번 수포자가 찍는 방식: 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, ... 2번 수포자가 찍는 방식: 2, 1, 2, 3, 2, 4, 2, 5, 2, 1, 2, 3, 2, 4, 2, 5..
2021.08.08 -
프로그래머스_프린터_python
https://programmers.co.kr/learn/courses/30/lessons/42587 중요도 순서로 인쇄. location 문서가 몇번째로 인쇄되는지 숫자 클수록 중요. from collections import deque def solution(priorities, location): answer = 0 d = deque([(v,i) for i,v in enumerate(priorities)]) while len(d): item = d.popleft() if d and max(d)[0] > item[0]: d.append(item) else: answer += 1 if item[1] == location: break return answer [코드1] deque를 사용. 반복문 사용해서..
2021.07.25