알고리즘/소스코드
KOREATECH 1035: 최소 이동거리
cjw.git
2020. 12. 11. 09:44
Link : judge.koreatech.ac.kr/problem.php?id=1035
Python
더보기
1
2
3
4
5
6
7
8
9
10
11
|
from sys import stdin
data_length = int(stdin.readline().strip())
arr = list(map(int, stdin.readline().strip().split()))
i = data_length // 2
sum = 0
for j in arr:
sum += abs(j - arr[i])
print(sum)
|
cs |
FeedBack
cjw.git@gmail.com