結果

問題 No.2053 12345...
ユーザー ytftytft
提出日時 2022-08-23 13:47:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 97 ms / 2,000 ms
コード長 179 bytes
コンパイル時間 306 ms
コンパイル使用メモリ 82,536 KB
実行使用メモリ 104,512 KB
最終ジャッジ日時 2024-04-19 04:44:29
合計ジャッジ時間 3,835 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,700 KB
testcase_01 AC 39 ms
52,552 KB
testcase_02 AC 47 ms
61,692 KB
testcase_03 AC 50 ms
70,492 KB
testcase_04 AC 72 ms
93,248 KB
testcase_05 AC 48 ms
66,968 KB
testcase_06 AC 68 ms
91,300 KB
testcase_07 AC 60 ms
80,816 KB
testcase_08 AC 63 ms
79,660 KB
testcase_09 AC 75 ms
94,360 KB
testcase_10 AC 88 ms
104,512 KB
testcase_11 AC 47 ms
66,460 KB
testcase_12 AC 44 ms
64,328 KB
testcase_13 AC 84 ms
103,324 KB
testcase_14 AC 54 ms
72,884 KB
testcase_15 AC 53 ms
72,576 KB
testcase_16 AC 57 ms
71,340 KB
testcase_17 AC 48 ms
66,988 KB
testcase_18 AC 97 ms
101,916 KB
testcase_19 AC 72 ms
93,956 KB
testcase_20 AC 44 ms
63,088 KB
testcase_21 AC 62 ms
81,988 KB
testcase_22 AC 41 ms
59,996 KB
testcase_23 AC 45 ms
63,928 KB
testcase_24 AC 50 ms
70,652 KB
testcase_25 AC 81 ms
102,688 KB
testcase_26 AC 58 ms
80,520 KB
testcase_27 AC 51 ms
70,748 KB
testcase_28 AC 51 ms
68,512 KB
testcase_29 AC 65 ms
88,336 KB
testcase_30 AC 49 ms
70,540 KB
testcase_31 AC 64 ms
87,080 KB
testcase_32 AC 94 ms
102,020 KB
権限があれば一括ダウンロードができます

ソースコード

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