結果

問題 No.275 中央値を求めよ
ユーザー fujitafujita
提出日時 2023-04-24 11:55:02
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 65 ms / 1,000 ms
コード長 964 bytes
コンパイル時間 11,841 ms
コンパイル使用メモリ 169,024 KB
実行使用メモリ 184,356 KB
最終ジャッジ日時 2024-04-26 01:49:45
合計ジャッジ時間 14,389 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
28,928 KB
testcase_01 AC 59 ms
29,312 KB
testcase_02 AC 60 ms
29,440 KB
testcase_03 AC 58 ms
29,440 KB
testcase_04 AC 55 ms
29,568 KB
testcase_05 AC 60 ms
29,440 KB
testcase_06 AC 60 ms
29,176 KB
testcase_07 AC 60 ms
29,568 KB
testcase_08 AC 61 ms
29,568 KB
testcase_09 AC 63 ms
29,568 KB
testcase_10 AC 61 ms
29,568 KB
testcase_11 AC 60 ms
29,184 KB
testcase_12 AC 56 ms
29,184 KB
testcase_13 AC 63 ms
29,292 KB
testcase_14 AC 62 ms
29,568 KB
testcase_15 AC 59 ms
29,432 KB
testcase_16 AC 60 ms
29,692 KB
testcase_17 AC 61 ms
29,824 KB
testcase_18 AC 61 ms
29,696 KB
testcase_19 AC 61 ms
29,440 KB
testcase_20 AC 61 ms
29,568 KB
testcase_21 AC 63 ms
29,824 KB
testcase_22 AC 64 ms
29,184 KB
testcase_23 AC 60 ms
29,680 KB
testcase_24 AC 60 ms
29,568 KB
testcase_25 AC 62 ms
29,312 KB
testcase_26 AC 64 ms
29,568 KB
testcase_27 AC 63 ms
29,696 KB
testcase_28 AC 62 ms
29,312 KB
testcase_29 AC 60 ms
29,304 KB
testcase_30 AC 65 ms
29,568 KB
testcase_31 AC 64 ms
29,420 KB
testcase_32 AC 64 ms
29,568 KB
testcase_33 AC 64 ms
29,184 KB
testcase_34 AC 59 ms
29,440 KB
testcase_35 AC 62 ms
29,304 KB
testcase_36 AC 61 ms
29,056 KB
testcase_37 AC 57 ms
29,696 KB
testcase_38 AC 60 ms
30,080 KB
testcase_39 AC 60 ms
29,312 KB
testcase_40 AC 62 ms
184,356 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (79 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/

ソースコード

diff #

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);
            }
        }
    }
}
0