結果
問題 |
No.24 数当てゲーム
|
ユーザー |
|
提出日時 | 2016-12-20 13:32:54 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 95 ms / 5,000 ms |
コード長 | 394 bytes |
コンパイル時間 | 509 ms |
コンパイル使用メモリ | 7,680 KB |
実行使用メモリ | 12,416 KB |
最終ジャッジ日時 | 2024-12-14 11:20:36 |
合計ジャッジ時間 | 1,877 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
コンパイルメッセージ
Syntax OK
ソースコード
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 })