結果
問題 |
No.275 中央値を求めよ
|
ユーザー |
![]() |
提出日時 | 2023-04-24 11:55:02 |
言語 | C# (.NET 8.0.404) |
結果 |
AC
|
実行時間 | 73 ms / 1,000 ms |
コード長 | 964 bytes |
コンパイル時間 | 12,524 ms |
コンパイル使用メモリ | 165,560 KB |
実行使用メモリ | 29,940 KB |
最終ジャッジ日時 | 2024-11-08 14:06:48 |
合計ジャッジ時間 | 16,971 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 38 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (109 ms)。 MSBuild のバージョン 17.9.6+a4ecab324 (.NET) main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
using System; namespace yukicoder { class Program { static void Main(string[] args) { double i, k = 0 , sum = 0; int N = int.Parse(Console.ReadLine()); var s = Console.ReadLine(); var z = s.Split(" "); double[] ints = new double[z.Length]; for (i = 0; i <= z.Length - 1; i++) { ints[(int)k] = double.Parse(z[(int)i]); sum += ints[(int)k]; k++; } Array.Sort(ints); double ty = ints.Length % 2; if ( ty == 1) { Console.WriteLine(ints[ints.Length / 2]); } else if (ty == 0) { double aa = ints[ints.Length / 2 - 1] ; double bb = ints[ints.Length / 2 ]; double cc = (aa + bb) / 2; Console.WriteLine(cc); } } } }