結果
| 問題 |
No.2053 12345...
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-03-20 21:15:58 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 102 ms / 2,000 ms |
| コード長 | 263 bytes |
| コンパイル時間 | 163 ms |
| コンパイル使用メモリ | 82,420 KB |
| 実行使用メモリ | 104,800 KB |
| 最終ジャッジ日時 | 2025-03-20 21:16:42 |
| 合計ジャッジ時間 | 3,724 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 31 |
ソースコード
n = int(input())
a = list(map(int, input().split()))
ans = 0
current = 1
for i in range(1, n):
if a[i] == a[i-1] + 1:
current += 1
else:
ans += current * (current - 1) // 2
current = 1
ans += current * (current - 1) // 2
print(ans)
lam6er