結果

問題 No.198 キャンディー・ボックス2
ユーザー rlangevinrlangevin
提出日時 2023-01-17 00:05:09
言語 PyPy3
(7.3.8)
結果
AC  
実行時間 73 ms / 1,000 ms
コード長 207 bytes
コンパイル時間 208 ms
使用メモリ 75,924 KB
最終ジャッジ日時 2023-01-17 00:05:42
合計ジャッジ時間 3,548 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 64 ms
75,788 KB
testcase_01 AC 68 ms
75,608 KB
testcase_02 AC 73 ms
75,496 KB
testcase_03 AC 67 ms
75,604 KB
testcase_04 AC 65 ms
75,776 KB
testcase_05 AC 72 ms
75,880 KB
testcase_06 AC 72 ms
75,776 KB
testcase_07 AC 66 ms
75,884 KB
testcase_08 AC 64 ms
75,816 KB
testcase_09 AC 63 ms
75,760 KB
testcase_10 AC 65 ms
75,764 KB
testcase_11 AC 65 ms
75,924 KB
testcase_12 AC 64 ms
75,496 KB
testcase_13 AC 64 ms
75,764 KB
testcase_14 AC 61 ms
75,800 KB
testcase_15 AC 64 ms
75,600 KB
testcase_16 AC 63 ms
75,820 KB
testcase_17 AC 65 ms
75,896 KB
testcase_18 AC 71 ms
75,712 KB
testcase_19 AC 70 ms
75,796 KB
testcase_20 AC 69 ms
75,704 KB
testcase_21 AC 68 ms
75,792 KB
testcase_22 AC 70 ms
75,788 KB
testcase_23 AC 72 ms
75,900 KB
testcase_24 AC 64 ms
75,704 KB
testcase_25 AC 64 ms
75,712 KB
testcase_26 AC 65 ms
75,792 KB
testcase_27 AC 62 ms
75,904 KB
testcase_28 AC 63 ms
75,552 KB
testcase_29 AC 63 ms
75,812 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

B = int(input())
N = int(input())
C = [0] * N
for i in range(N):
    C[i] = int(input())
    B += C[i]
M = B//N
C.sort()
M = min(M, C[N//2])
ans = 0
for i in range(N):
    ans += abs(M - C[i])
print(ans)    
0