結果
問題 | No.21 平均の差 |
ユーザー | nbisco |
提出日時 | 2016-03-21 13:43:36 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 35 ms / 5,000 ms |
コード長 | 376 bytes |
コンパイル時間 | 215 ms |
コンパイル使用メモリ | 11,904 KB |
実行使用メモリ | 10,112 KB |
最終ジャッジ日時 | 2024-04-08 21:20:15 |
合計ジャッジ時間 | 948 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 30 ms
10,112 KB |
testcase_01 | AC | 33 ms
10,112 KB |
testcase_02 | AC | 30 ms
10,112 KB |
testcase_03 | AC | 31 ms
10,112 KB |
testcase_04 | AC | 33 ms
10,112 KB |
testcase_05 | AC | 35 ms
10,112 KB |
testcase_06 | AC | 30 ms
10,112 KB |
testcase_07 | AC | 31 ms
10,112 KB |
testcase_08 | AC | 30 ms
10,112 KB |
testcase_09 | AC | 31 ms
10,112 KB |
ソースコード
#!/usr/bin/env python3 #fileencoding: utf-8 from math import ceil N = int(input()) K = int(input()) n = sorted([int(input()) for i in range(N)]) max_avg = n[-1] max_group_size = N - ceil(N/K) min_avg = n[0] for i in range(1,max_group_size): tmp = ceil(sum(n[:i+1]) / (i+1)) if min_avg >= tmp: min_avg = tmp else: break print(max_avg - min_avg)