結果

問題 No.21 平均の差
ユーザー cccccc
提出日時 2022-08-19 14:23:51
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 51 ms / 5,000 ms
コード長 737 bytes
コンパイル時間 10,012 ms
コンパイル使用メモリ 169,984 KB
実行使用メモリ 183,348 KB
最終ジャッジ日時 2024-04-16 19:20:24
合計ジャッジ時間 10,933 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
28,904 KB
testcase_01 AC 50 ms
28,544 KB
testcase_02 AC 50 ms
29,184 KB
testcase_03 AC 51 ms
28,544 KB
testcase_04 AC 51 ms
29,056 KB
testcase_05 AC 50 ms
28,800 KB
testcase_06 AC 51 ms
28,800 KB
testcase_07 AC 50 ms
28,544 KB
testcase_08 AC 51 ms
28,544 KB
testcase_09 AC 50 ms
183,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (91 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;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    static void Main()
    {
        // 要素数取得 5
        var N = int.Parse(Console.ReadLine());
        // グループ数取得 3
        var K = int.Parse(Console.ReadLine());
        // 空配列生成
        var x = new int[N];
        
        // 要素を空配列に代入
        for(var i = 0; N > i; i++)
        {
            x[i] = int.Parse(Console.ReadLine());
        }
        // 配列をソート
        Array.Sort(x);

        // ソートした配列の最大値と最小値を引き算
        var ans = x[N -1] - x[0];
        // 解答表示
        Console.WriteLine(ans);
    }
}
0