結果

問題 No.275 中央値を求めよ
コンテスト
ユーザー t__nabe
提出日時 2020-03-13 18:04:57
言語 Swift
(6.2.4)
コンパイル:
swiftc _filename_ -Ounchecked -o a.out
実行:
./a.out
結果
AC  
実行時間 5 ms / 1,000 ms
コード長 234 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,303 ms
コンパイル使用メモリ 152,168 KB
実行使用メモリ 10,240 KB
最終ジャッジ日時 2026-05-24 07:49:37
合計ジャッジ時間 3,008 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

let count = Int(readLine()!)!
let numbers = readLine()!.split{$0 == " "}.map { Int($0)! }.sorted()

if count % 2 == 0 {
    print(Float(numbers[count / 2 - 1] + numbers[count / 2]) / Float(2))
} else {
    print(numbers[count / 2])
}
0