結果
| 問題 |
No.275 中央値を求めよ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-07-23 16:53:15 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 343 bytes |
| コンパイル時間 | 2,620 ms |
| コンパイル使用メモリ | 156,224 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-12 21:06:55 |
| 合計ジャッジ時間 | 3,752 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
ソースコード
import std.stdio, std.conv, std.string, std.range, std.array, std.algorithm;
void main() {
int N = to!int(readln().strip());
int[] lst = readln().strip().split().map!(to!int)().array();
lst.sort!();
if (N % 2 == 0) {
writeln((lst[N / 2 - 1] + lst[N / 2]) / 2.0);
}
else {
writeln(lst[N / 2]);
}
}