結果

問題 No.2335 Jump
ユーザー 👑 kakel-sankakel-san
提出日時 2023-06-02 21:30:54
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 108 ms / 2,000 ms
コード長 571 bytes
コンパイル時間 1,192 ms
コンパイル使用メモリ 71,872 KB
実行使用メモリ 31,400 KB
最終ジャッジ日時 2023-08-28 02:47:13
合計ジャッジ時間 4,160 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
21,744 KB
testcase_01 AC 62 ms
21,620 KB
testcase_02 AC 60 ms
21,556 KB
testcase_03 AC 60 ms
21,612 KB
testcase_04 AC 61 ms
21,548 KB
testcase_05 AC 61 ms
21,680 KB
testcase_06 AC 61 ms
21,604 KB
testcase_07 AC 68 ms
21,692 KB
testcase_08 AC 67 ms
23,772 KB
testcase_09 AC 70 ms
21,732 KB
testcase_10 AC 69 ms
19,708 KB
testcase_11 AC 68 ms
23,684 KB
testcase_12 AC 105 ms
29,364 KB
testcase_13 AC 106 ms
31,400 KB
testcase_14 AC 106 ms
29,328 KB
testcase_15 AC 107 ms
29,296 KB
testcase_16 AC 108 ms
29,388 KB
testcase_17 AC 99 ms
27,816 KB
testcase_18 AC 108 ms
29,520 KB
testcase_19 AC 106 ms
29,640 KB
testcase_20 AC 98 ms
27,808 KB
testcase_21 AC 100 ms
28,164 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static int NN => int.Parse(ReadLine());
    static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var n = NN;
        var a = NList;
        for (var i = n - 1; i >= 0; --i)
        {
            if (i == 0 || a[i - 1] < a[i] - 1)
            {
                WriteLine(a[i] - 1 - i);
                return;
            }
        }
    }
}
0