結果

問題 No.120 傾向と対策:門松列(その1)
ユーザー 小指が強い人小指が強い人
提出日時 2015-11-15 18:54:09
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 536 bytes
コンパイル時間 393 ms
コンパイル使用メモリ 11,420 KB
実行使用メモリ 15,800 KB
最終ジャッジ日時 2023-10-11 16:28:37
合計ジャッジ時間 1,761 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

t = gets.to_i
t.times do 
    n = gets.to_i
    a = gets.split.map(&:to_i)
    h1 = Hash.new(0)
    n.times do |i|
        h1[a[i]] += 1
    end
    res = 0
    count = 0
    while true do
        find = false
        h1.each_key do |k|
            if h1[k] > 0
                h1[k] -= 1
                count += 1
            end
            if count >= 3
                count = 0
                res += 1
                find = true
            end
        end
        if !find
            break
        end
    end
    puts res
end
0