結果
問題 | No.275 中央値を求めよ |
ユーザー |
|
提出日時 | 2017-06-07 17:21:29 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 260 bytes |
コンパイル時間 | 2,518 ms |
コンパイル使用メモリ | 155,904 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-12 19:45:07 |
合計ジャッジ時間 | 3,150 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 38 |
ソースコード
import std.algorithm, std.conv, std.range, std.stdio, std.string;void main(){auto n = readln.chomp.to!size_t;auto ai = readln.split.to!(int[]);ai.sort();if (n % 2)writeln(ai[n/2]);elsewriteln((ai[n/2-1] + ai[n/2]).to!real / 2);}