結果

問題 No.24 数当てゲーム
ユーザー mesh1nek0x0mesh1nek0x0
提出日時 2018-06-30 23:44:12
言語 Ruby
(3.3.0)
結果
AC  
実行時間 79 ms / 5,000 ms
コード長 333 bytes
コンパイル時間 310 ms
コンパイル使用メモリ 11,280 KB
実行使用メモリ 15,340 KB
最終ジャッジ日時 2023-09-13 16:26:27
合計ジャッジ時間 2,246 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
15,100 KB
testcase_01 AC 79 ms
15,028 KB
testcase_02 AC 77 ms
15,148 KB
testcase_03 AC 78 ms
15,300 KB
testcase_04 AC 78 ms
15,312 KB
testcase_05 AC 78 ms
15,300 KB
testcase_06 AC 77 ms
15,292 KB
testcase_07 AC 77 ms
15,260 KB
testcase_08 AC 78 ms
15,160 KB
testcase_09 AC 77 ms
15,340 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

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

box = []
1.upto(10) do |num|
  box.push(0)
end

1.upto(N) do |num|
  turn = gets.chomp.split(' ')
  if turn[4] === 'YES'
    tmp = 1
  else
    tmp = -1
  end
  
  box[turn[0].to_i] += tmp
  box[turn[1].to_i] += tmp
  box[turn[2].to_i] += tmp
  box[turn[3].to_i] += tmp
end

puts box.index(box.max)

0