結果
問題 | No.29 パワーアップ |
ユーザー |
|
提出日時 | 2019-04-30 17:44:24 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 100 ms / 5,000 ms |
コード長 | 254 bytes |
コンパイル時間 | 133 ms |
コンパイル使用メモリ | 7,296 KB |
実行使用メモリ | 12,288 KB |
最終ジャッジ日時 | 2024-12-30 14:48:58 |
合計ジャッジ時間 | 3,202 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 22 |
コンパイルメッセージ
Syntax OK
ソースコード
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