結果

問題 No.29 パワーアップ
ユーザー fshutofshuto
提出日時 2019-04-30 17:44:24
言語 Ruby
(3.1.1p18 )
結果
AC  
実行時間 74 ms / 5,000 ms
コード長 254 bytes
コンパイル時間 32 ms
使用メモリ 14,004 KB
最終ジャッジ日時 2023-01-16 10:54:50
合計ジャッジ時間 2,992 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 73 ms
13,844 KB
testcase_01 AC 72 ms
13,904 KB
testcase_02 AC 73 ms
13,728 KB
testcase_03 AC 72 ms
13,788 KB
testcase_04 AC 74 ms
13,828 KB
testcase_05 AC 74 ms
13,808 KB
testcase_06 AC 74 ms
13,804 KB
testcase_07 AC 73 ms
13,900 KB
testcase_08 AC 74 ms
13,984 KB
testcase_09 AC 74 ms
13,836 KB
testcase_10 AC 73 ms
13,780 KB
testcase_11 AC 73 ms
14,004 KB
testcase_12 AC 73 ms
13,948 KB
testcase_13 AC 73 ms
13,732 KB
testcase_14 AC 72 ms
13,960 KB
testcase_15 AC 73 ms
13,796 KB
testcase_16 AC 74 ms
13,856 KB
testcase_17 AC 74 ms
13,960 KB
testcase_18 AC 73 ms
13,708 KB
testcase_19 AC 73 ms
13,848 KB
testcase_20 AC 73 ms
13,700 KB
testcase_21 AC 73 ms
13,832 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

items = Hash.new(0)
gets.to_i.times do
  a, b, c = gets.split.map(&:to_i)
  items[a] += 1
  items[b] += 1
  items[c] += 1
end
ans = 0
items.each do |item|
  if item[1] >= 2
    ans += item[1] / 2
  end
end
puts ans + (items.values.inject(:+) - ans*2) / 4
0