結果
| 問題 | No.275 中央値を求めよ |
| コンテスト | |
| ユーザー |
ub_nyaoiix
|
| 提出日時 | 2016-12-17 16:05:55 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 23 ms / 1,000 ms |
| コード長 | 404 bytes |
| 記録 | |
| コンパイル時間 | 679 ms |
| コンパイル使用メモリ | 110,672 KB |
| 実行使用メモリ | 27,952 KB |
| 最終ジャッジ日時 | 2026-03-11 04:17:13 |
| 合計ジャッジ時間 | 2,646 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
class Q0275
{
public static void Main()
{
int n = int.Parse(Console.ReadLine());
string[] num = Console.ReadLine().Split(' ');
int[] a = new int[n];
for (int i=0; i<n; i++)
{
a[i] = int.Parse(num[i]);
}
Array.Sort(a);
float output;
if(n%2 > 0)
{
output = a[n/2];
}
else
{
output = (float)(a[n/2] + a[n/2-1])/2;
}
Console.WriteLine(output);
}
}
ub_nyaoiix