結果

問題 No.21 平均の差
ユーザー fujitafujita
提出日時 2023-04-27 16:57:40
言語 C#
(.NET 8.0.203)
結果
WA  
実行時間 -
コード長 843 bytes
コンパイル時間 8,341 ms
コンパイル使用メモリ 166,560 KB
実行使用メモリ 184,984 KB
最終ジャッジ日時 2024-04-28 08:44:51
合計ジャッジ時間 9,528 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
29,440 KB
testcase_01 AC 52 ms
29,696 KB
testcase_02 AC 59 ms
29,440 KB
testcase_03 AC 58 ms
29,568 KB
testcase_04 AC 53 ms
29,824 KB
testcase_05 AC 56 ms
29,696 KB
testcase_06 WA -
testcase_07 AC 55 ms
29,952 KB
testcase_08 AC 54 ms
29,696 KB
testcase_09 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (80 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();
            }
            Array.Sort(strings);

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

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