結果

問題 No.275 中央値を求めよ
ユーザー nohopennohopen
提出日時 2019-02-11 09:21:50
言語 Scheme
(Gauche-0.9.14)
結果
AC  
実行時間 19 ms / 1,000 ms
コード長 423 bytes
コンパイル時間 33 ms
コンパイル使用メモリ 5,212 KB
実行使用メモリ 14,232 KB
最終ジャッジ日時 2023-09-24 23:45:03
合計ジャッジ時間 2,548 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
12,036 KB
testcase_01 AC 19 ms
12,072 KB
testcase_02 AC 18 ms
12,076 KB
testcase_03 AC 18 ms
13,896 KB
testcase_04 AC 18 ms
11,892 KB
testcase_05 AC 18 ms
11,912 KB
testcase_06 AC 18 ms
12,060 KB
testcase_07 AC 18 ms
11,900 KB
testcase_08 AC 18 ms
11,948 KB
testcase_09 AC 18 ms
11,740 KB
testcase_10 AC 18 ms
12,056 KB
testcase_11 AC 18 ms
11,932 KB
testcase_12 AC 18 ms
11,624 KB
testcase_13 AC 18 ms
11,748 KB
testcase_14 AC 18 ms
13,748 KB
testcase_15 AC 19 ms
14,232 KB
testcase_16 AC 19 ms
12,232 KB
testcase_17 AC 19 ms
12,104 KB
testcase_18 AC 18 ms
12,088 KB
testcase_19 AC 19 ms
11,796 KB
testcase_20 AC 19 ms
12,204 KB
testcase_21 AC 18 ms
12,144 KB
testcase_22 AC 19 ms
12,124 KB
testcase_23 AC 19 ms
11,948 KB
testcase_24 AC 18 ms
11,948 KB
testcase_25 AC 19 ms
12,096 KB
testcase_26 AC 19 ms
11,968 KB
testcase_27 AC 18 ms
11,968 KB
testcase_28 AC 18 ms
11,696 KB
testcase_29 AC 19 ms
11,832 KB
testcase_30 AC 18 ms
11,916 KB
testcase_31 AC 18 ms
11,928 KB
testcase_32 AC 18 ms
11,932 KB
testcase_33 AC 19 ms
11,812 KB
testcase_34 AC 18 ms
11,696 KB
testcase_35 AC 19 ms
11,760 KB
testcase_36 AC 19 ms
11,972 KB
testcase_37 AC 18 ms
11,964 KB
testcase_38 AC 18 ms
11,936 KB
testcase_39 AC 18 ms
11,920 KB
testcase_40 AC 19 ms
11,868 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

(define (median str)
  (let* ((sorted (sort str)))
    (if (= (modulo (length str) 2) 1)
        (list-ref sorted (quotient (length str) 2))
        (/. (+ (list-ref sorted (quotient (length str) 2))
               (list-ref sorted (- (quotient (length str) 2) 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