結果

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

ソースコード

diff #
raw source code

# 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