結果

問題 No.29 パワーアップ
ユーザー mesh1nek0x0mesh1nek0x0
提出日時 2018-07-02 23:53:26
言語 Ruby
(3.1.1p18 )
結果
AC  
実行時間 73 ms / 5,000 ms
コード長 296 bytes
コンパイル時間 555 ms
使用メモリ 13,992 KB
最終ジャッジ日時 2023-02-01 02:46:38
合計ジャッジ時間 2,962 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 72 ms
13,980 KB
testcase_01 AC 71 ms
13,848 KB
testcase_02 AC 71 ms
13,824 KB
testcase_03 AC 71 ms
13,800 KB
testcase_04 AC 71 ms
13,948 KB
testcase_05 AC 71 ms
13,792 KB
testcase_06 AC 72 ms
13,780 KB
testcase_07 AC 72 ms
13,828 KB
testcase_08 AC 71 ms
13,804 KB
testcase_09 AC 71 ms
13,808 KB
testcase_10 AC 72 ms
13,940 KB
testcase_11 AC 71 ms
13,788 KB
testcase_12 AC 72 ms
13,956 KB
testcase_13 AC 71 ms
13,976 KB
testcase_14 AC 71 ms
13,952 KB
testcase_15 AC 72 ms
13,864 KB
testcase_16 AC 72 ms
13,992 KB
testcase_17 AC 71 ms
13,960 KB
testcase_18 AC 71 ms
13,792 KB
testcase_19 AC 73 ms
13,980 KB
testcase_20 AC 72 ms
13,984 KB
testcase_21 AC 71 ms
13,824 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

#!/bin/ruby
N = gets.chomp.to_i

item = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
1.upto(N) do |num|
  tmp = gets.chomp.split(' ')
  item[tmp[0].to_i - 1] += 1
  item[tmp[1].to_i - 1] += 1
  item[tmp[2].to_i - 1] += 1
end

lv = 0
ex = 0
item.each { |num| 
  lv += num / 2
  ex += num % 2
}

puts lv + ex / 4
0