Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 그래프 이론
- BFS
- deep learning
- r-cnn
- opencv
- CNN
- machine learning
- object detection
- YoLO
- C++
- two-stage detector
- 강화학습
- LSTM
- One-Stage Detector
- dynamic programming
- image processing
- Python
- 딥러닝
- MinHeap
- AlexNet
- Mask Processing
- dfs
- MySQL
- 백준
- Reinforcement Learning
- eecs 498
- 머신러닝
- DP
- canny edge detection
- real-time object detection
Archives
- Today
- Total
목록heapq (1)
JINWOOJUNG

접근법 최소 비교 횟수를 구하기 위해서는 입력받은 묶음의 크기를 정렬한 후 작은 2개의 묶음의 크기부터 더해나가서 계산할 수 있다. 따라서 양쪽으로 입출력이 가능한 deque 자료구조를 사용하여 구현하였다. from collections import deque N = int(input()) tmp = [] for i in range(N): tmp.append(int(input())) tmp.sort() queue = deque() for i in range(N): queue.append(tmp[i]) result = 0 for _ in range(1,N): a = queue.popleft() b = queue.popleft() result += a+b queue.appendleft(a+b) print(r..
백준
2023. 12. 28. 16:29