結果

問題 No.2053 12345...
ユーザー Taichi.NTaichi.N
提出日時 2022-10-04 15:32:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 133 ms / 2,000 ms
コード長 257 bytes
コンパイル時間 991 ms
コンパイル使用メモリ 86,928 KB
実行使用メモリ 100,740 KB
最終ジャッジ日時 2023-08-28 17:47:03
合計ジャッジ時間 6,676 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,368 KB
testcase_01 AC 71 ms
71,252 KB
testcase_02 AC 79 ms
76,588 KB
testcase_03 AC 83 ms
81,436 KB
testcase_04 AC 107 ms
98,380 KB
testcase_05 AC 84 ms
79,440 KB
testcase_06 AC 104 ms
95,652 KB
testcase_07 AC 96 ms
89,220 KB
testcase_08 AC 93 ms
87,616 KB
testcase_09 AC 107 ms
98,464 KB
testcase_10 AC 124 ms
100,352 KB
testcase_11 AC 82 ms
78,600 KB
testcase_12 AC 85 ms
76,680 KB
testcase_13 AC 128 ms
99,884 KB
testcase_14 AC 95 ms
83,636 KB
testcase_15 AC 93 ms
82,592 KB
testcase_16 AC 94 ms
82,420 KB
testcase_17 AC 88 ms
79,336 KB
testcase_18 AC 133 ms
99,968 KB
testcase_19 AC 111 ms
99,172 KB
testcase_20 AC 85 ms
76,412 KB
testcase_21 AC 100 ms
89,180 KB
testcase_22 AC 75 ms
76,440 KB
testcase_23 AC 78 ms
77,592 KB
testcase_24 AC 87 ms
82,480 KB
testcase_25 AC 123 ms
99,912 KB
testcase_26 AC 93 ms
89,160 KB
testcase_27 AC 85 ms
82,508 KB
testcase_28 AC 84 ms
80,588 KB
testcase_29 AC 98 ms
93,640 KB
testcase_30 AC 83 ms
81,468 KB
testcase_31 AC 99 ms
93,404 KB
testcase_32 AC 129 ms
100,740 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int, input().split()))

ans = 0
i, j = 0, 1

while i < n:
    k = 0
    while j < n:
        if A[j] - A[i] != j - i:
            break
        k += 1
        j += 1
    i = j
    j += 1
    ans += (k + 1) * k // 2

print(ans)
0