[백준 3948번] 홍준이의 친위대 (Python3)
for i in range(int(input())): print([1,2,4,10,32,122,544,2770,15872,101042,707584,5405530,44736512,398721962,3807514624,38783024290,419730685952,4809759350882,58177770225664,740742376475050][int(input())-1]) 지그재그 서기 [백준 1146번] 지그재그 서기 (Python3) (tistory.com) 와 똑같은 문제에서 테스트케이스 수가 늘었고, N의 크기가 매우 작아졌다. 따라서 그냥 지그재그 서기의 알고리즘으로 1~20까지의 값을 구한 뒤, 출력해주었다.
[백준 3163번] 떨어지는 개미 (Python3)
import sys,collections input = sys.stdin.readline for _ in range(int(input())): N,L,k = map(int,input().split()) location,id = [],collections.deque() fall = [] for _ in range(N): l,i = map(int,input().split()) location.append(l) id.append(i) if i < 0: fall.append((location.pop(),id.popleft())) while location: fall.append((L-location.pop(),id.pop())) print(sorted(fall)[k-1][1]) 스택을 이용해서 해결하였다. 아이..