結果

問題 No.24 数当てゲーム
ユーザー 小指が強い人小指が強い人
提出日時 2015-11-12 21:37:26
言語 Ruby
(3.3.0)
結果
AC  
実行時間 83 ms / 5,000 ms
コード長 339 bytes
コンパイル時間 56 ms
コンパイル使用メモリ 11,560 KB
実行使用メモリ 15,344 KB
最終ジャッジ日時 2023-10-11 15:44:36
合計ジャッジ時間 1,705 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
15,344 KB
testcase_01 AC 81 ms
15,152 KB
testcase_02 AC 82 ms
15,168 KB
testcase_03 AC 81 ms
15,048 KB
testcase_04 AC 82 ms
15,304 KB
testcase_05 AC 83 ms
15,120 KB
testcase_06 AC 82 ms
15,256 KB
testcase_07 AC 81 ms
15,332 KB
testcase_08 AC 83 ms
15,044 KB
testcase_09 AC 82 ms
15,092 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

Num = Struct.new(:num, :count)
n = gets.to_i
a = Array.new(10)
10.times do |i|
    a[i] = Num.new(i, 0)
end
n.times do |x|
    s = gets.split
    4.times do |i|
        if s[4] == "YES"
            a[s[i].to_i].count += 1
        else
            a[s[i].to_i].count -= 1
        end
    end
end
puts a.max{ |a, b| a.count <=> b.count }.num
0