結果

問題 No.29 パワーアップ
ユーザー letrangerjpletrangerjp
提出日時 2017-06-13 16:55:25
言語 Ruby
(3.1.1p18 )
結果
AC  
実行時間 74 ms / 5,000 ms
コード長 254 bytes
コンパイル時間 101 ms
使用メモリ 13,964 KB
最終ジャッジ日時 2022-11-23 11:39:41
合計ジャッジ時間 3,011 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 69 ms
13,900 KB
testcase_01 AC 73 ms
13,944 KB
testcase_02 AC 72 ms
13,836 KB
testcase_03 AC 71 ms
13,796 KB
testcase_04 AC 70 ms
13,796 KB
testcase_05 AC 72 ms
13,780 KB
testcase_06 AC 74 ms
13,856 KB
testcase_07 AC 72 ms
13,776 KB
testcase_08 AC 71 ms
13,888 KB
testcase_09 AC 70 ms
13,956 KB
testcase_10 AC 70 ms
13,772 KB
testcase_11 AC 68 ms
13,860 KB
testcase_12 AC 70 ms
13,948 KB
testcase_13 AC 70 ms
13,816 KB
testcase_14 AC 69 ms
13,964 KB
testcase_15 AC 68 ms
13,808 KB
testcase_16 AC 67 ms
13,820 KB
testcase_17 AC 69 ms
13,816 KB
testcase_18 AC 67 ms
13,720 KB
testcase_19 AC 69 ms
13,732 KB
testcase_20 AC 70 ms
13,848 KB
testcase_21 AC 71 ms
13,848 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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