結果

問題 No.21 平均の差
ユーザー yutakahanyutakahan
提出日時 2017-12-06 10:33:53
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 54 ms / 5,000 ms
コード長 734 bytes
コンパイル時間 2,370 ms
コンパイル使用メモリ 101,672 KB
実行使用メモリ 22,716 KB
最終ジャッジ日時 2023-08-19 09:37:08
合計ジャッジ時間 4,049 ms
ジャッジサーバーID
(参考情報)
judge10 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
20,648 KB
testcase_01 AC 53 ms
22,716 KB
testcase_02 AC 52 ms
20,668 KB
testcase_03 AC 53 ms
20,744 KB
testcase_04 AC 54 ms
22,704 KB
testcase_05 AC 53 ms
20,672 KB
testcase_06 AC 53 ms
20,676 KB
testcase_07 AC 52 ms
20,672 KB
testcase_08 AC 53 ms
20,748 KB
testcase_09 AC 53 ms
20,672 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
public class Hello{
    static void AscSort(int[] a){
        for(int x = 0;x < a.Length - 1;x++){
            for(int y = x + 1;y < a.Length;y++){
                if(a[x] > a[y]){
                    int temp;
                    temp = a[x];
                    a[x] = a[y];
                    a[y] = temp;
                }
            }
        }
    }
    public static void Main(){
        int N = int.Parse(Console.ReadLine());
        int K = int.Parse(Console.ReadLine());
        int[] Num = new int[N];
        for(int i = 0;i < N;i++){
            int input = int.Parse(Console.ReadLine());
            Num[i] = input;
        }
        AscSort(Num);
        Console.WriteLine(Num[N - 1] - Num[0]);
    }
}
0