結果
| 問題 |
No.2053 12345...
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-06-14 19:25:53 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 90 ms / 2,000 ms |
| コード長 | 330 bytes |
| コンパイル時間 | 435 ms |
| コンパイル使用メモリ | 82,392 KB |
| 実行使用メモリ | 104,320 KB |
| 最終ジャッジ日時 | 2024-06-23 02:34:28 |
| 合計ジャッジ時間 | 4,041 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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))