結果

問題 No.609 Noelちゃんと星々
ユーザー serser
提出日時 2017-12-16 00:35:52
言語 Ruby
(3.3.0)
結果
AC  
実行時間 153 ms / 2,000 ms
コード長 127 bytes
コンパイル時間 258 ms
コンパイル使用メモリ 11,316 KB
実行使用メモリ 23,740 KB
最終ジャッジ日時 2023-08-21 06:57:00
合計ジャッジ時間 4,603 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
21,656 KB
testcase_01 AC 105 ms
18,160 KB
testcase_02 AC 98 ms
16,960 KB
testcase_03 AC 105 ms
18,076 KB
testcase_04 AC 92 ms
16,284 KB
testcase_05 AC 149 ms
22,940 KB
testcase_06 AC 134 ms
21,680 KB
testcase_07 AC 112 ms
19,148 KB
testcase_08 AC 85 ms
15,600 KB
testcase_09 AC 102 ms
17,452 KB
testcase_10 AC 120 ms
20,084 KB
testcase_11 AC 118 ms
19,660 KB
testcase_12 AC 129 ms
20,816 KB
testcase_13 AC 88 ms
15,996 KB
testcase_14 AC 84 ms
15,536 KB
testcase_15 AC 137 ms
21,896 KB
testcase_16 AC 152 ms
23,268 KB
testcase_17 AC 131 ms
21,632 KB
testcase_18 AC 99 ms
16,992 KB
testcase_19 AC 132 ms
21,676 KB
testcase_20 AC 150 ms
23,660 KB
testcase_21 AC 152 ms
23,660 KB
testcase_22 AC 152 ms
23,588 KB
testcase_23 AC 152 ms
23,740 KB
testcase_24 AC 153 ms
23,512 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.to_i
array = gets.split(" ").map(&:to_i).sort
center = array[n/2]
puts array.inject(0) {|sum, i| sum + (center-i).abs}
0