알고리즘(python)/자료구조
[Python]Queue 백준 1966
문제 https://www.acmicpc.net/problem/1966 큐자료 구조를 사용하여 풀었다.원하는 문서가 우선순위가 가장높다면 출력해주고그렇지 않다면 우선순위가 가장 높은 문서가 나올때까지 계속 뒤에 붙여준다.이를 반복하여 원하는 문서가 출력될때 이때까지 출력된 문서의 개수를 출력해준다. 12345678910111213141516171819202122232425import sys n=int(input()) while n>0: n-=1 N, M = map(int, sys.stdin.readline().split()) que = list(map(int, sys.stdin.readline().split())) chk = [0 for _ in range(N)] chk[M] = 1#원하는 문서의 위치 ..
2020. 1. 17. 00:11
최근댓글