結果

問題 No.2053 12345...
ユーザー gemmarogemmaro
提出日時 2022-08-21 13:26:52
言語 Ruby
(3.2.2)
結果
AC  
実行時間 218 ms / 2,000 ms
コード長 181 bytes
コンパイル時間 580 ms
コンパイル使用メモリ 11,384 KB
実行使用メモリ 35,560 KB
最終ジャッジ日時 2023-07-31 12:37:39
合計ジャッジ時間 6,142 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
15,308 KB
testcase_01 AC 79 ms
15,132 KB
testcase_02 AC 82 ms
15,104 KB
testcase_03 AC 103 ms
18,520 KB
testcase_04 AC 154 ms
25,392 KB
testcase_05 AC 96 ms
17,144 KB
testcase_06 AC 148 ms
24,372 KB
testcase_07 AC 124 ms
21,392 KB
testcase_08 AC 120 ms
20,736 KB
testcase_09 AC 151 ms
25,552 KB
testcase_10 AC 177 ms
28,836 KB
testcase_11 AC 94 ms
16,832 KB
testcase_12 AC 89 ms
16,268 KB
testcase_13 AC 211 ms
33,780 KB
testcase_14 AC 129 ms
20,484 KB
testcase_15 AC 114 ms
19,664 KB
testcase_16 AC 114 ms
19,220 KB
testcase_17 AC 108 ms
17,996 KB
testcase_18 AC 218 ms
35,560 KB
testcase_19 AC 162 ms
27,712 KB
testcase_20 AC 90 ms
15,884 KB
testcase_21 AC 147 ms
21,060 KB
testcase_22 AC 79 ms
15,252 KB
testcase_23 AC 88 ms
16,284 KB
testcase_24 AC 105 ms
18,916 KB
testcase_25 AC 176 ms
28,404 KB
testcase_26 AC 123 ms
21,208 KB
testcase_27 AC 108 ms
18,880 KB
testcase_28 AC 105 ms
17,712 KB
testcase_29 AC 148 ms
24,048 KB
testcase_30 AC 105 ms
18,380 KB
testcase_31 AC 143 ms
23,888 KB
testcase_32 AC 189 ms
30,264 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
A = gets.split.map { _1.to_i }
D = A.chunk_while { |a,b| a + 1 == b }
  .map { _1.size }
  .select { _1 >= 2 }
  .map { _1 * (_1 - 1) / 2 }
  .sum
  .tap { puts(_1) }
0