結果

問題 No.2053 12345...
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-08-21 13:31:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 97 ms / 2,000 ms
コード長 334 bytes
コンパイル時間 300 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 107,520 KB
最終ジャッジ日時 2024-04-18 12:52:56
合計ジャッジ時間 3,528 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
51,840 KB
testcase_01 AC 35 ms
51,584 KB
testcase_02 AC 43 ms
59,264 KB
testcase_03 AC 48 ms
70,400 KB
testcase_04 AC 82 ms
95,424 KB
testcase_05 AC 49 ms
67,328 KB
testcase_06 AC 68 ms
92,160 KB
testcase_07 AC 60 ms
82,304 KB
testcase_08 AC 57 ms
80,000 KB
testcase_09 AC 71 ms
95,616 KB
testcase_10 AC 88 ms
107,520 KB
testcase_11 AC 47 ms
66,560 KB
testcase_12 AC 49 ms
63,364 KB
testcase_13 AC 86 ms
106,240 KB
testcase_14 AC 54 ms
73,856 KB
testcase_15 AC 51 ms
71,808 KB
testcase_16 AC 51 ms
72,192 KB
testcase_17 AC 45 ms
67,456 KB
testcase_18 AC 93 ms
101,796 KB
testcase_19 AC 71 ms
96,256 KB
testcase_20 AC 44 ms
62,780 KB
testcase_21 AC 62 ms
81,792 KB
testcase_22 AC 40 ms
59,264 KB
testcase_23 AC 41 ms
64,512 KB
testcase_24 AC 50 ms
71,808 KB
testcase_25 AC 82 ms
105,692 KB
testcase_26 AC 59 ms
81,664 KB
testcase_27 AC 49 ms
71,424 KB
testcase_28 AC 46 ms
68,864 KB
testcase_29 AC 64 ms
88,704 KB
testcase_30 AC 48 ms
69,760 KB
testcase_31 AC 66 ms
87,680 KB
testcase_32 AC 97 ms
102,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int,input().split())) + [10**10]
ans = 0
last = -1
count = 0
for i,a in enumerate(A):
    if last == -1:
        last = a
        count += 1
        
    else:
        if a == last+1:
            count += 1
        else:
            ans += count*(count-1)//2
            count = 1
    last = a
print(ans)
0