結果

問題 No.349 干支の置き物
ユーザー basie23basie23
提出日時 2016-12-21 23:28:51
言語 Ruby
(3.3.0)
結果
AC  
実行時間 82 ms / 2,000 ms
コード長 743 bytes
コンパイル時間 56 ms
コンパイル使用メモリ 11,268 KB
実行使用メモリ 15,292 KB
最終ジャッジ日時 2023-08-21 05:17:24
合計ジャッジ時間 4,331 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
15,084 KB
testcase_01 AC 82 ms
15,212 KB
testcase_02 AC 78 ms
15,292 KB
testcase_03 AC 78 ms
15,224 KB
testcase_04 AC 79 ms
15,136 KB
testcase_05 AC 80 ms
15,084 KB
testcase_06 AC 80 ms
15,128 KB
testcase_07 AC 79 ms
15,016 KB
testcase_08 AC 77 ms
15,192 KB
testcase_09 AC 77 ms
15,128 KB
testcase_10 AC 78 ms
15,172 KB
testcase_11 AC 78 ms
15,128 KB
testcase_12 AC 78 ms
15,096 KB
testcase_13 AC 78 ms
15,272 KB
testcase_14 AC 78 ms
15,216 KB
testcase_15 AC 78 ms
15,024 KB
testcase_16 AC 78 ms
15,116 KB
testcase_17 AC 78 ms
15,288 KB
testcase_18 AC 77 ms
15,100 KB
testcase_19 AC 78 ms
15,176 KB
testcase_20 AC 78 ms
15,152 KB
testcase_21 AC 79 ms
15,284 KB
testcase_22 AC 79 ms
15,112 KB
testcase_23 AC 77 ms
15,088 KB
testcase_24 AC 78 ms
15,132 KB
testcase_25 AC 78 ms
15,024 KB
testcase_26 AC 80 ms
15,116 KB
testcase_27 AC 79 ms
15,168 KB
testcase_28 AC 78 ms
15,100 KB
testcase_29 AC 79 ms
15,168 KB
testcase_30 AC 78 ms
15,176 KB
testcase_31 AC 79 ms
15,284 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.chomp.to_i
ne = ushi = tora = u = tatsu = mi = uma = hitsuji = saru = tori = inu = i = 0.to_i
c = n / 2
n.times do
eto = gets.chomp

case eto
when "ne"
  ne = ne + 1
when "ushi"
  ushi = ushi + 1
when "tora"
  tora = tora + 1
when "u"
  u = u + 1
when "tatsu"
  tatsu = tatsu + 1
when "mi"
  mi = mi + 1
when "uma"
  uma = uma + 1
when "hitsuji"
  hitsuji = hitsuji + 1
when "saru"
  saru = saru + 1
when "tori"
  tori = tori + 1
when "inu"
  inu = inu + 1
when "i"
  i = i + 1
end
end

ary = [ne, ushi, tora, u, tatsu, mi, uma, hitsuji, saru, tori, inu, i]
newary = ary.sort

max = newary[11]

if n % 2 == 0
  if max <= c
    puts 'YES'
  else
    puts 'NO'
  end
else
  if max <= c + 1
    puts 'YES'
  else
    puts 'NO'
  end
end
0