結果
問題 |
No.275 中央値を求めよ
|
ユーザー |
|
提出日時 | 2017-06-19 19:56:56 |
言語 | D (dmd 2.109.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 527 bytes |
コンパイル時間 | 2,306 ms |
コンパイル使用メモリ | 150,800 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-12 20:17:04 |
合計ジャッジ時間 | 3,499 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | AC * 9 WA * 29 |
ソースコード
import std.stdio, std.string, std.conv, std.algorithm; import std.range, std.array, std.math, std.typecons; int n; int[] a; void main() { scan(n); a = readln.split.to!(int[]); if (n & 1) { writeln(a[n/2]); } else { double ans = (a[n/2] + a[n/2 - 1]) / 2.0; writefln("%.1f", ans); } } void scan(T...)(ref T args) { auto line = readln.split; foreach (ref arg ; args) { arg = line.front.to!(typeof(arg)); line.popFront(); } assert(line.empty); }