結果
問題 | No.275 中央値を求めよ |
ユーザー |
![]() |
提出日時 | 2016-11-23 18:09:11 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 43 ms / 1,000 ms |
コード長 | 519 bytes |
コンパイル時間 | 1,236 ms |
コンパイル使用メモリ | 107,008 KB |
実行使用メモリ | 20,992 KB |
最終ジャッジ日時 | 2024-06-25 00:09:01 |
合計ジャッジ時間 | 3,764 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 38 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;using System.Linq;namespace No275{class Program{static void Main(string[] args){var N = int.Parse(Console.ReadLine());var As = Console.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();var ordered = As.OrderBy(a => a).ToArray();var result = N % 2 == 0? new[] { ordered[N / 2 - 1], ordered[N / 2] }.Average(): ordered[N / 2];Console.Write(result);}}}