結果

問題 No.24 数当てゲーム
ユーザー takaboujptakaboujp
提出日時 2016-12-20 13:32:54
言語 Ruby
(3.3.0)
結果
AC  
実行時間 88 ms / 5,000 ms
コード長 394 bytes
コンパイル時間 64 ms
コンパイル使用メモリ 11,568 KB
実行使用メモリ 15,304 KB
最終ジャッジ日時 2023-08-21 03:11:28
合計ジャッジ時間 1,710 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
15,176 KB
testcase_01 AC 81 ms
15,048 KB
testcase_02 AC 80 ms
15,288 KB
testcase_03 AC 80 ms
15,180 KB
testcase_04 AC 81 ms
15,132 KB
testcase_05 AC 86 ms
15,240 KB
testcase_06 AC 81 ms
15,148 KB
testcase_07 AC 81 ms
15,304 KB
testcase_08 AC 80 ms
15,112 KB
testcase_09 AC 79 ms
15,132 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

NUMBER_OF_QUESTIONS = gets.to_i
number_array = []
(0..9).each do |i|
  number_array[i] = 0
end

NUMBER_OF_QUESTIONS.times do
  get_string = gets
  numbers = get_string[0, 7].split.map(&:to_i).to_a
  inside_answer = get_string.split.last == 'YES' ? 1 : -1
  numbers.each do |number|
    number_array[number] += inside_answer
  end
end

puts number_array.index(number_array.max_by { |num| num })
0