結果
問題 | No.275 中央値を求めよ |
ユーザー |
![]() |
提出日時 | 2019-05-16 23:37:59 |
言語 | Nim (2.2.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 308 bytes |
コンパイル時間 | 3,514 ms |
コンパイル使用メモリ | 65,536 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-02 01:30:19 |
合計ジャッジ時間 | 4,741 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 38 |
ソースコード
import algorithm, strutils, sequtils let n: int = stdin.readLine.parseInt var aaa: seq[int] = stdin.readLine.split.map(parseInt) aaa.sort(system.cmp[int]) var index = 0 if aaa.len mod 2 != 0: index = int(aaa.high/2) echo aaa[index] else: index = int(aaa.high/2) echo (aaa[index] + aaa[index+1])/2