結果

問題 No.135 とりあえず1次元の問題
ユーザー akichiakichi
提出日時 2017-08-09 23:21:04
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 581 bytes
コンパイル時間 713 ms
コンパイル使用メモリ 109,444 KB
実行使用メモリ 33,736 KB
最終ジャッジ日時 2024-04-20 08:44:44
合計ジャッジ時間 2,185 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
31,540 KB
testcase_01 AC 23 ms
25,356 KB
testcase_02 AC 24 ms
23,472 KB
testcase_03 AC 25 ms
27,292 KB
testcase_04 WA -
testcase_05 AC 24 ms
23,348 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 28 ms
25,764 KB
testcase_20 WA -
testcase_21 AC 57 ms
32,128 KB
testcase_22 AC 54 ms
33,736 KB
evil01.txt AC 54 ms
31,944 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Linq;
class Program {
    static void Main() {
        int n = int.Parse(Console.ReadLine());
        int min = 1000001;
        if (n < 2) {
            min = 0;
        } else {
            var q = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();
            for (int i = 0; i < n - 1; i++) {
                if (q[i] == q[i + 1]) continue;
                int d = Math.Abs(q[i] - q[i + 1]);
                if (d < min) min = d;
            }
            if (min == 1000001) min = 0;
        }
        Console.WriteLine(min);
    }
}
0