結果

問題 No.2053 12345...
ユーザー SyuKing_OrderSyuKing_Order
提出日時 2022-08-21 13:02:57
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 141 ms / 2,000 ms
コード長 287 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 86,996 KB
実行使用メモリ 113,524 KB
最終ジャッジ日時 2023-07-31 12:31:51
合計ジャッジ時間 5,304 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,292 KB
testcase_01 AC 74 ms
71,108 KB
testcase_02 AC 122 ms
76,140 KB
testcase_03 AC 88 ms
83,612 KB
testcase_04 AC 118 ms
107,824 KB
testcase_05 AC 84 ms
80,144 KB
testcase_06 AC 111 ms
103,804 KB
testcase_07 AC 101 ms
94,336 KB
testcase_08 AC 98 ms
92,336 KB
testcase_09 AC 118 ms
107,872 KB
testcase_10 AC 133 ms
109,364 KB
testcase_11 AC 86 ms
79,460 KB
testcase_12 AC 83 ms
76,688 KB
testcase_13 AC 137 ms
108,868 KB
testcase_14 AC 95 ms
86,488 KB
testcase_15 AC 92 ms
84,668 KB
testcase_16 AC 90 ms
84,940 KB
testcase_17 AC 85 ms
80,504 KB
testcase_18 AC 141 ms
113,400 KB
testcase_19 AC 118 ms
107,956 KB
testcase_20 AC 81 ms
76,216 KB
testcase_21 AC 103 ms
94,360 KB
testcase_22 AC 80 ms
76,292 KB
testcase_23 AC 83 ms
77,896 KB
testcase_24 AC 91 ms
84,792 KB
testcase_25 AC 133 ms
108,880 KB
testcase_26 AC 100 ms
94,464 KB
testcase_27 AC 90 ms
84,904 KB
testcase_28 AC 88 ms
82,292 KB
testcase_29 AC 109 ms
100,660 KB
testcase_30 AC 88 ms
83,384 KB
testcase_31 AC 108 ms
100,248 KB
testcase_32 AC 137 ms
113,524 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
    
0