結果

問題 No.198 キャンディー・ボックス2
ユーザー pluto77
提出日時 2016-05-02 09:34:34
言語 Python2
(2.7.18)
結果
AC  
実行時間 10 ms / 1,000 ms
コード長 231 bytes
コンパイル時間 542 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-16 09:55:48
合計ジャッジ時間 1,535 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
# yuki_198

b=int(raw_input())
n=int(raw_input())
s=[]
for i in xrange(n):
 temp=int(raw_input())
 s.append(temp)
s.sort()
key=min((sum(s)+b)/n,s[n/2])
res=0
for i in xrange(len(s)):
 res+=abs(s[i]-key)
 
print res
0