結果

問題 No.21 平均の差
ユーザー MiyamonYMiyamonY
提出日時 2019-09-03 01:57:32
言語 Scheme
(Gauche-0.9.14)
結果
AC  
実行時間 25 ms / 5,000 ms
コード長 426 bytes
コンパイル時間 72 ms
コンパイル使用メモリ 5,296 KB
実行使用メモリ 14,836 KB
最終ジャッジ日時 2023-08-23 07:46:56
合計ジャッジ時間 1,430 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
12,636 KB
testcase_01 AC 25 ms
12,792 KB
testcase_02 AC 25 ms
14,636 KB
testcase_03 AC 24 ms
12,616 KB
testcase_04 AC 25 ms
12,628 KB
testcase_05 AC 25 ms
12,624 KB
testcase_06 AC 25 ms
14,836 KB
testcase_07 AC 25 ms
12,708 KB
testcase_08 AC 24 ms
12,712 KB
testcase_09 AC 25 ms
12,640 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

(define (ave10 arr)
  (define len (length arr))
  (div (* 10 (fold + 0 arr)) len))

(define (solve k arr)
  (define len (length arr))
  (define max (ave10 (take-right arr 1)))
  (define min (ave10 (take arr 1)))
  (div (+ (- max min) 9) 10))

(let* ((n (string->number (read-line)))
       (k (string->number (read-line)))
       (arr (map (lambda (_) (string->number (read-line))) (iota n))))
  (print (solve k (sort arr))))
0