結果

問題 No.2053 12345...
ユーザー 👑 kakel-sankakel-san
提出日時 2022-08-28 20:44:25
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 106 ms / 2,000 ms
コード長 695 bytes
コンパイル時間 824 ms
コンパイル使用メモリ 108,144 KB
実行使用メモリ 47,168 KB
最終ジャッジ日時 2024-04-23 17:10:30
合計ジャッジ時間 4,363 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
25,480 KB
testcase_01 AC 24 ms
25,092 KB
testcase_02 AC 29 ms
27,788 KB
testcase_03 AC 44 ms
28,388 KB
testcase_04 AC 81 ms
43,812 KB
testcase_05 AC 39 ms
26,416 KB
testcase_06 AC 77 ms
44,640 KB
testcase_07 AC 59 ms
34,184 KB
testcase_08 AC 56 ms
33,848 KB
testcase_09 AC 81 ms
41,648 KB
testcase_10 AC 97 ms
44,480 KB
testcase_11 AC 39 ms
26,920 KB
testcase_12 AC 35 ms
28,632 KB
testcase_13 AC 99 ms
46,188 KB
testcase_14 AC 50 ms
29,964 KB
testcase_15 AC 47 ms
27,968 KB
testcase_16 AC 45 ms
30,364 KB
testcase_17 AC 41 ms
26,588 KB
testcase_18 AC 106 ms
46,940 KB
testcase_19 AC 86 ms
44,068 KB
testcase_20 AC 32 ms
26,080 KB
testcase_21 AC 59 ms
31,764 KB
testcase_22 AC 28 ms
25,824 KB
testcase_23 AC 34 ms
26,432 KB
testcase_24 AC 44 ms
28,424 KB
testcase_25 AC 96 ms
44,240 KB
testcase_26 AC 58 ms
31,864 KB
testcase_27 AC 45 ms
28,380 KB
testcase_28 AC 43 ms
28,384 KB
testcase_29 AC 75 ms
42,140 KB
testcase_30 AC 45 ms
28,508 KB
testcase_31 AC 75 ms
41,864 KB
testcase_32 AC 106 ms
47,168 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 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();
    static void Main()
    {
        var n = NN;
        var a = NList;
        var res = 0L;
        var cnt = 1L;
        for (var i = 0; i < a.Length; ++i)
        {
            if (i + 1 < a.Length && a[i + 1] - a[i] == 1)
            {
                ++cnt;
            }
            else
            {
                res += cnt * (cnt - 1) / 2;
                cnt = 1;
            }
        }
        WriteLine(res);
    }
}
0