結果
| 問題 | No.2053 12345... |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-06-14 19:25:53 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 97 ms / 2,000 ms |
| + 957µs | |
| コード長 | 330 bytes |
| 記録 | |
| コンパイル時間 | 242 ms |
| コンパイル使用メモリ | 95,804 KB |
| 実行使用メモリ | 115,968 KB |
| 最終ジャッジ日時 | 2026-07-27 13:37:18 |
| 合計ジャッジ時間 | 5,226 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 31 |
ソースコード
def C(n, A):
count = 0
i = 0
while i < n:
j = i + 1
while j < n and A[j] - A[j - 1] == 1:
j += 1
length = j - i
if length >= 2:
count += (length - 1) * length // 2
i = j
return count
N = int(input())
A = list(map(int, input().split()))
print(C(N, A))