結果
| 問題 |
No.135 とりあえず1次元の問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-11-11 11:12:37 |
| 言語 | C# (.NET 8.0.404) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,033 bytes |
| コンパイル時間 | 8,803 ms |
| コンパイル使用メモリ | 167,908 KB |
| 実行使用メモリ | 43,440 KB |
| 最終ジャッジ日時 | 2025-11-11 11:12:49 |
| 合計ジャッジ時間 | 11,835 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 2 WA * 20 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (112 ミリ秒)。 main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
class Program
{
static void Main(string[] args)
{
string inputCount = Console.ReadLine()!;
string[] inputNum = Console.ReadLine()!.Split(' ');
List<int> numList = new List<int>();
int ans = 0;
if (inputCount == "1")
{
Console.WriteLine(0);
return;
}
for (int i = 0; i < inputNum.Length; i++)
{
numList.Add(int.Parse(inputNum[i]));
}
numList.Sort();
for (int i = 1; i < numList.Count; i++)
{
int firstPoint = int.Parse(inputNum[i - 1]);
int secondPoint = int.Parse(inputNum[i]);
if (i == 1 && secondPoint - firstPoint != 0)
{
ans = secondPoint - firstPoint;
}
else if (ans > secondPoint - firstPoint)
{
ans = secondPoint - firstPoint;
}
}
if (ans <= -1)
{
ans *= -1;
}
Console.WriteLine(ans);
}
}