結果

問題 No.275 中央値を求めよ
ユーザー nohopennohopen
提出日時 2019-02-11 09:28:16
言語 Scheme
(Gauche-0.9.14)
結果
AC  
実行時間 20 ms / 1,000 ms
コード長 474 bytes
コンパイル時間 55 ms
コンパイル使用メモリ 5,340 KB
実行使用メモリ 13,864 KB
最終ジャッジ日時 2023-09-24 23:56:19
合計ジャッジ時間 2,908 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
11,776 KB
testcase_01 AC 18 ms
11,780 KB
testcase_02 AC 18 ms
11,924 KB
testcase_03 AC 19 ms
11,904 KB
testcase_04 AC 18 ms
11,872 KB
testcase_05 AC 18 ms
12,060 KB
testcase_06 AC 19 ms
12,024 KB
testcase_07 AC 19 ms
11,900 KB
testcase_08 AC 19 ms
11,764 KB
testcase_09 AC 19 ms
11,712 KB
testcase_10 AC 19 ms
11,916 KB
testcase_11 AC 19 ms
11,696 KB
testcase_12 AC 19 ms
11,628 KB
testcase_13 AC 19 ms
11,688 KB
testcase_14 AC 19 ms
11,696 KB
testcase_15 AC 20 ms
12,192 KB
testcase_16 AC 19 ms
12,024 KB
testcase_17 AC 20 ms
12,284 KB
testcase_18 AC 19 ms
12,064 KB
testcase_19 AC 18 ms
11,812 KB
testcase_20 AC 19 ms
13,864 KB
testcase_21 AC 19 ms
12,096 KB
testcase_22 AC 19 ms
12,100 KB
testcase_23 AC 19 ms
11,908 KB
testcase_24 AC 18 ms
11,896 KB
testcase_25 AC 19 ms
12,020 KB
testcase_26 AC 19 ms
11,756 KB
testcase_27 AC 19 ms
13,760 KB
testcase_28 AC 18 ms
11,696 KB
testcase_29 AC 19 ms
11,940 KB
testcase_30 AC 19 ms
11,724 KB
testcase_31 AC 18 ms
11,960 KB
testcase_32 AC 18 ms
11,916 KB
testcase_33 AC 19 ms
12,004 KB
testcase_34 AC 18 ms
11,808 KB
testcase_35 AC 19 ms
11,820 KB
testcase_36 AC 19 ms
11,936 KB
testcase_37 AC 18 ms
11,908 KB
testcase_38 AC 18 ms
12,080 KB
testcase_39 AC 18 ms
11,924 KB
testcase_40 AC 19 ms
11,908 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

(define (median str)
  (let* ((sorted (sort str))    ;ソートされた数列
         (len (length str))     ;数列の長さ
         (mid (quotient len 2)));数列の中央
    (if (= (modulo len 2) 1)
        (list-ref sorted mid)
        (/. (+ (list-ref sorted mid)
               (list-ref sorted (- mid 1))) 2))))

(define (create-list n)
  (if (= n 0) '()
      (cons (read) (create-list (- n 1)))))

(define (main args)
  (print (median (create-list (read)))) 0)
0