結果
| 問題 | No.21 平均の差 |
| コンテスト | |
| ユーザー |
SagToki
|
| 提出日時 | 2018-06-07 16:01:24 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 25 ms / 5,000 ms |
| コード長 | 862 bytes |
| 記録 | |
| コンパイル時間 | 2,089 ms |
| コンパイル使用メモリ | 110,904 KB |
| 実行使用メモリ | 17,920 KB |
| 最終ジャッジ日時 | 2024-06-30 10:29:52 |
| 合計ジャッジ時間 | 2,837 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
namespace ConsoleApp5 {
class Program {
static void Main(string[] args) {
int N = Input(3, 9);
int K = Input(3, N);
int[] n = new int[N];
for(int i = 0; i < N; i++) {
n[i] = Input(1, 1000);
}
Array.Sort(n);
int Answer = n[N - 1] - n[0];
Console.WriteLine(Answer);
}
static int Input(int Min , int Max) {
int Number = int.Parse(Console.ReadLine());
try {
if (Number < Min || Number > Max) {
Console.WriteLine(Min + "以上" + Max + "以下で入力してください");
}
}catch(Exception E) {
Console.WriteLine("想定外のエラーです");
}
return Number;
}
}
}
SagToki