結果

問題 No.21 平均の差
ユーザー fujitafujita
提出日時 2023-04-27 17:01:35
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 68 ms / 5,000 ms
コード長 853 bytes
コンパイル時間 7,760 ms
コンパイル使用メモリ 165,692 KB
実行使用メモリ 184,636 KB
最終ジャッジ日時 2024-04-28 08:46:30
合計ジャッジ時間 9,302 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

namespace yukicoder
{
    class Program
    {

        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int K = int.Parse(Console.ReadLine());
            string[] strings = new string[N];
            float[] ints = new float[N];
            for (int i = 0; i < N; i++)
            {
                strings[i] = Console.ReadLine();
            }
            

            for(int j = 0; j < strings.Length; j++)
            {
                ints[j] = float.Parse(strings[j]);
            }
            Array.Sort(ints);

            var hiave = ints[N - 1] / 1;
            var lowave = ints[0] / 1;
            var ans = Math.Ceiling(hiave - lowave);
            Console.WriteLine(ans);
        }
    }
}
0