結果

問題 No.1374 Absolute Game
ユーザー simansiman
提出日時 2021-03-23 11:24:28
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 209 bytes
コンパイル時間 189 ms
コンパイル使用メモリ 11,424 KB
実行使用メモリ 23,780 KB
最終ジャッジ日時 2023-08-16 13:54:42
合計ジャッジ時間 4,875 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
15,044 KB
testcase_01 WA -
testcase_02 AC 80 ms
15,280 KB
testcase_03 AC 77 ms
15,276 KB
testcase_04 WA -
testcase_05 AC 80 ms
15,272 KB
testcase_06 AC 79 ms
15,088 KB
testcase_07 AC 77 ms
15,148 KB
testcase_08 AC 100 ms
17,324 KB
testcase_09 AC 127 ms
21,180 KB
testcase_10 AC 134 ms
22,084 KB
testcase_11 AC 119 ms
19,812 KB
testcase_12 AC 101 ms
17,736 KB
testcase_13 AC 123 ms
20,812 KB
testcase_14 AC 150 ms
23,624 KB
testcase_15 WA -
testcase_16 AC 149 ms
23,592 KB
testcase_17 WA -
testcase_18 AC 151 ms
23,588 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 117 ms
19,160 KB
testcase_22 AC 155 ms
23,236 KB
testcase_23 WA -
testcase_24 AC 89 ms
15,996 KB
testcase_25 AC 91 ms
16,536 KB
testcase_26 AC 104 ms
17,656 KB
testcase_27 AC 109 ms
18,904 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
C = gets.split.map(&:to_i).sort.reverse
S = C.sum

if S < 0
  N.times do |i|
    C[i] = -1 * C[i]
  end
end

a = 0
b = 0

C.each_slice(2) do |x, y|
  a += x
  b += y if y
end

puts a.abs - b.abs
0