Skip to content

Commit 0d347be

Browse files
authored
Merge pull request #168 from AlgoLeadMe/40-pknujsp
40-pknujsp
2 parents 83f9c41 + 8c9453e commit 0d347be

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

โ€Žpknujsp/README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,5 @@
4040
| 36์ฐจ์‹œ | 2024.02.21 | ์ด์ง„ํƒ์ƒ‰ | [ํœด๊ฒŒ์†Œ ์„ธ์šฐ๊ธฐ](https://www.acmicpc.net/problem/1477) | [#143](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/143) |
4141
| 37์ฐจ์‹œ | 2024.03.04 | ๊ตฌํ˜„ | [n+1 ์นด๋“œ๊ฒŒ์ž„](https://school.programmers.co.kr/learn/courses/30/lessons/258707) | [#149](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/149) |
4242
| 38์ฐจ์‹œ | 2024.03.08 | BRUTE_FORCE | [์ž๋ฌผ์‡ ์™€ ์—ด์‡ ](https://school.programmers.co.kr/learn/courses/30/lessons/60059) | [#154](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/154) |
43-
| 39์ฐจ์‹œ | 2024.03.19 | ํ | [๋””์Šคํฌ ์ปจํŠธ๋กค๋Ÿฌ](https://school.programmers.co.kr/learn/courses/30/lessons/42627) | [#163](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/163) |
43+
| 39์ฐจ์‹œ | 2024.03.19 | ํ | [๋””์Šคํฌ ์ปจํŠธ๋กค๋Ÿฌ](https://school.programmers.co.kr/learn/courses/30/lessons/42627) | [#163](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/163) |
44+
| 40์ฐจ์‹œ | 2024.03.22 | ๊ทธ๋ฆฌ๋”” | [์„ผ์„œ](https://www.acmicpc.net/problem/2212) | [#168](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/168) |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from sys import *
2+
3+
N = int(stdin.readline())
4+
K = int(stdin.readline())
5+
SENSORS = sorted(set(map(int, stdin.readline().split())))
6+
7+
if K >= N:
8+
print(0)
9+
exit()
10+
11+
distances = [SENSORS[i] - SENSORS[i - 1] for i in range(1, len(SENSORS))]
12+
distances.sort(reverse=True)
13+
14+
result = 0
15+
for i in range(K - 1, len(distances)):
16+
result += distances[i]
17+
18+
print(result)

0 commit comments

Comments
ย (0)