結果

問題 No.2053 12345...
ユーザー gemmarogemmaro
提出日時 2022-08-21 13:26:52
言語 Ruby
(3.3.0)
結果
AC  
実行時間 226 ms / 2,000 ms
コード長 181 bytes
コンパイル時間 194 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 32,896 KB
最終ジャッジ日時 2024-04-18 12:52:31
合計ジャッジ時間 5,752 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
12,160 KB
testcase_01 AC 82 ms
12,160 KB
testcase_02 AC 84 ms
12,160 KB
testcase_03 AC 106 ms
15,616 KB
testcase_04 AC 155 ms
22,400 KB
testcase_05 AC 97 ms
13,824 KB
testcase_06 AC 146 ms
20,992 KB
testcase_07 AC 123 ms
18,560 KB
testcase_08 AC 126 ms
17,792 KB
testcase_09 AC 157 ms
22,528 KB
testcase_10 AC 179 ms
26,368 KB
testcase_11 AC 95 ms
13,696 KB
testcase_12 AC 90 ms
13,440 KB
testcase_13 AC 212 ms
30,592 KB
testcase_14 AC 131 ms
16,000 KB
testcase_15 AC 117 ms
16,128 KB
testcase_16 AC 121 ms
15,744 KB
testcase_17 AC 109 ms
15,488 KB
testcase_18 AC 226 ms
32,896 KB
testcase_19 AC 166 ms
24,320 KB
testcase_20 AC 91 ms
12,672 KB
testcase_21 AC 151 ms
19,712 KB
testcase_22 AC 85 ms
12,160 KB
testcase_23 AC 91 ms
13,312 KB
testcase_24 AC 105 ms
16,384 KB
testcase_25 AC 169 ms
25,856 KB
testcase_26 AC 129 ms
18,304 KB
testcase_27 AC 108 ms
15,744 KB
testcase_28 AC 105 ms
15,232 KB
testcase_29 AC 148 ms
21,248 KB
testcase_30 AC 107 ms
15,488 KB
testcase_31 AC 145 ms
20,736 KB
testcase_32 AC 194 ms
29,056 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