結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
15,240 KB
testcase_01 AC 77 ms
15,348 KB
testcase_02 AC 77 ms
15,152 KB
testcase_03 AC 81 ms
15,148 KB
testcase_04 AC 76 ms
15,120 KB
testcase_05 WA -
testcase_06 AC 77 ms
15,332 KB
testcase_07 WA -
testcase_08 AC 99 ms
17,296 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 118 ms
19,760 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 158 ms
23,632 KB
testcase_16 WA -
testcase_17 AC 159 ms
23,736 KB
testcase_18 WA -
testcase_19 AC 159 ms
23,604 KB
testcase_20 AC 108 ms
18,024 KB
testcase_21 AC 120 ms
19,440 KB
testcase_22 AC 156 ms
23,184 KB
testcase_23 AC 84 ms
15,696 KB
testcase_24 WA -
testcase_25 AC 90 ms
16,480 KB
testcase_26 AC 100 ms
17,768 KB
testcase_27 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
C = gets.split.map(&:to_i).sort
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