結果
問題 | No.275 中央値を求めよ |
ユーザー |
|
提出日時 | 2020-02-19 23:46:34 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 42 ms / 1,000 ms |
コード長 | 555 bytes |
コンパイル時間 | 1,251 ms |
コンパイル使用メモリ | 110,308 KB |
実行使用メモリ | 28,684 KB |
最終ジャッジ日時 | 2024-10-08 18:25:29 |
合計ジャッジ時間 | 4,215 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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;using System.Collections.Generic;namespace _0275{class Program{static void Main(string[] args){var n = int.Parse(Console.ReadLine());var a = Console.ReadLine().Split().Select(i => int.Parse(i)).OrderBy(i => i).ToArray();if(n % 2 == 0){var m = a[n / 2] + a[(n / 2) - 1];Console.WriteLine(string.Format("{0:f1}",m / 2.0));}else{Console.WriteLine(a[n / 2]);}}}}