結果

問題 No.2053 12345...
ユーザー ytft
提出日時 2022-08-23 13:47:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 100 ms / 2,000 ms
コード長 179 bytes
コンパイル時間 216 ms
コンパイル使用メモリ 82,352 KB
実行使用メモリ 104,420 KB
最終ジャッジ日時 2024-10-10 21:21:01
合計ジャッジ時間 4,423 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=list(map(int,input().split()))
temp,ans=0,0
for i in range(N-1):
	if A[i+1]-A[i]==1:
		temp+=1
	else:
		ans+=temp*(temp+1)//2
		temp=0
print(ans+temp*(temp+1)//2)
0