結果

問題 No.29 パワーアップ
ユーザー letrangerjp
提出日時 2017-06-13 16:55:25
言語 Ruby
(3.4.1)
結果
AC  
実行時間 89 ms / 5,000 ms
コード長 254 bytes
コンパイル時間 38 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-09-24 16:58:21
合計ジャッジ時間 2,726 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i

inventory = [0] * 11
$<.map{|s|
  gained = s.split.take(3).map(&:to_i)

  gained.each{|item|
    inventory[item] += 1
  }
}

res = 0
inventory.map!{|count|
  cnt, rest = count.divmod(2)
  res += cnt
  rest
}
res += inventory.sum / 4
p res
0