結果
問題 |
No.135 とりあえず1次元の問題
|
ユーザー |
![]() |
提出日時 | 2023-05-10 10:56:25 |
言語 | C# (.NET 8.0.404) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,976 bytes |
コンパイル時間 | 12,260 ms |
コンパイル使用メモリ | 167,016 KB |
実行使用メモリ | 42,600 KB |
最終ジャッジ日時 | 2024-11-26 15:48:11 |
合計ジャッジ時間 | 11,789 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 1 |
other | AC * 21 WA * 1 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (93 ms)。 MSBuild のバージョン 17.9.6+a4ecab324 (.NET) main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
using System.Collections.Generic; using System; using System.Drawing; namespace yukicoder { class Program { static void Main(string[] args) { int N = int.Parse(Console.ReadLine()); var str = Console.ReadLine().Split(" "); int n = 0, ans = 0 , temp = 0; List<int> list = new List<int>(N); for(int i = 0; i < N; i++) { list.Add(int.Parse(str[i])); if (list[n] == 0) { list.RemoveAt(n); n--; } n++; } list.Sort(); if (list.Count < 2) { Console.WriteLine("0"); } else if (!(list.Count < 2)) { temp = list[list.Count - 1]; } for (int j = 0; j < list.Count ; j++) { ans = list[j + 1] - list[j]; if(ans < temp && !(list.Count <= 2) || j == list.Count - 2 && !(list.Count <= 2)) { if(j == list.Count - 2) { Console.WriteLine(temp); break; } else if (ans == 0) { Console.WriteLine(list[j + 1] / list[j]); break; } else if (list[j + 1] == list[j]) { temp = list[j + 1] / list[j]; } else { temp = ans; } } else if (list.Count <= 2) { Console.WriteLine(list[j + 1] - list[j]); break; } } } } }