結果

問題 No.21 平均の差
ユーザー yutakahan
提出日時 2017-12-06 10:33:53
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 25 ms / 5,000 ms
コード長 734 bytes
コンパイル時間 837 ms
コンパイル使用メモリ 107,816 KB
実行使用メモリ 25,940 KB
最終ジャッジ日時 2024-11-29 00:56:56
合計ジャッジ時間 1,723 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます
コンパイルメッセージ
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