結果
| 問題 | 
                            No.21 平均の差
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2022-06-07 10:59:37 | 
| 言語 | C#(csc)  (csc 3.9.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,182 bytes | 
| コンパイル時間 | 790 ms | 
| コンパイル使用メモリ | 110,408 KB | 
| 実行使用メモリ | 26,060 KB | 
| 最終ジャッジ日時 | 2024-09-21 04:51:54 | 
| 合計ジャッジ時間 | 1,589 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 5 WA * 5 | 
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
namespace yukicoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //N行目
            int N = int.Parse(Console.ReadLine());
            //Kグループに振り分ける
            int K = int.Parse(Console.ReadLine());
            int[] a = new int[N];
            //nを配列に入れる
            for(int i=0;i<N;i++)
            {
                //数字 N個入力する
                int n = int.Parse(Console.ReadLine());
                a[i] = n;
            }
            //nを小さい順に並び替え
            for(int i=0;i<N;i++)
            {
                for(int j=0;j<i;j++)
                {
                    if (a[i - 1] > a[i])
                    {
                        int temp = a[i];
                        a[i] = a[i - 1];
                        a[i - 1] = temp;
                        i--; 
                    }
                }
            }
            int ans = 0;
            //ソートした最小と最大を引く
                ans = a[N-1] - a[0];
            //表示は文字列にする
            Console.WriteLine(ans.ToString());
        }
    }
}