File tree 2 files changed +20
-1
lines changed
2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 40
40
| 36์ฐจ์ | 2024.02.21 | ์ด์งํ์ | [ ํด๊ฒ์ ์ธ์ฐ๊ธฐ] ( https://www.acmicpc.net/problem/1477 ) | [ #143 ] ( https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/143 ) |
41
41
| 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 ) |
42
42
| 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 number Diff line number Diff line change
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 )
You canโt perform that action at this time.
0 commit comments