2019-02-03 23:50:50 UNSELECTED

2/3のAtCoderBeginnerContestC問題 https://atcoder.jp/c

Copy Copied! Full
N,M=input().split() N=int(N) M=int(M) Xs=[int(x) for x in input().split()] Xs.sort() Ds=[0]*(M-1) for i in range(M-1): Ds[i]=Xs[i+1]-Xs[i] Ds.sort() print(Xs) print(Ds) if N>=M: print(0) else: print(sum(Ds[:-N+1]))
2/3のAtCoderBeginnerContestC問題
https://atcoder.jp/contests/abc117/tasks/abc117_c