結果

問題 No.29 パワーアップ
ユーザー simansiman
提出日時 2015-01-11 05:17:43
言語 Ruby
(3.1.1p18 )
結果
AC  
実行時間 74 ms / 5,000 ms
コード長 351 bytes
コンパイル時間 239 ms
使用メモリ 13,996 KB
最終ジャッジ日時 2023-01-19 13:16:09
合計ジャッジ時間 3,016 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 74 ms
13,848 KB
testcase_01 AC 73 ms
13,804 KB
testcase_02 AC 74 ms
13,836 KB
testcase_03 AC 74 ms
13,996 KB
testcase_04 AC 74 ms
13,804 KB
testcase_05 AC 73 ms
13,836 KB
testcase_06 AC 74 ms
13,964 KB
testcase_07 AC 73 ms
13,976 KB
testcase_08 AC 73 ms
13,832 KB
testcase_09 AC 74 ms
13,856 KB
testcase_10 AC 73 ms
13,880 KB
testcase_11 AC 73 ms
13,800 KB
testcase_12 AC 74 ms
13,836 KB
testcase_13 AC 73 ms
13,816 KB
testcase_14 AC 73 ms
13,840 KB
testcase_15 AC 72 ms
13,784 KB
testcase_16 AC 73 ms
13,916 KB
testcase_17 AC 74 ms
13,836 KB
testcase_18 AC 74 ms
13,864 KB
testcase_19 AC 74 ms
13,984 KB
testcase_20 AC 73 ms
13,848 KB
testcase_21 AC 74 ms
13,824 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

class A
  def initialize
    n = gets.chomp.to_i

    items = Array.new(11, 0)

    n.times do
      list = gets.chomp.split(' ').map(&:to_i)

      list.each do |id|
        items[id] += 1
      end
    end

    answer = 0
    sub = 0

    items.each do |num|
      answer += num/2
      sub += num%2
    end

    puts answer + sub/4
  end
end

A.new
0