結果
| 問題 |
No.2053 12345...
|
| コンテスト | |
| ユーザー |
SyuKing_Order
|
| 提出日時 | 2022-08-21 13:02:57 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 107 ms / 2,000 ms |
| コード長 | 287 bytes |
| コンパイル時間 | 247 ms |
| コンパイル使用メモリ | 82,264 KB |
| 実行使用メモリ | 112,084 KB |
| 最終ジャッジ日時 | 2024-10-10 05:59:44 |
| 合計ジャッジ時間 | 3,520 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 31 |
ソースコード
n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(n-1):
b.append(a[i+1]-a[i])
count = 0
ans = 0
for i in range(n-1):
if b[i] == 1:
count += 1
else:
ans += (1+count)*count//2
count = 0
ans += (1+count)*count//2
print(ans)
SyuKing_Order