結果

問題 No.29 パワーアップ
ユーザー Lo_OT
提出日時 2018-02-17 16:28:55
言語 Ruby
(3.4.1)
結果
AC  
実行時間 87 ms / 5,000 ms
コード長 271 bytes
コンパイル時間 191 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-06-24 12:13:11
合計ジャッジ時間 2,886 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:19: warning: `-' after local variable or literal is interpreted as binary operator
Main.rb:19: warning: even though it seems like unary operator
Syntax OK

ソースコード

diff #

ans = 0
h={}
loop = gets.to_i
11.times{|i|h[i]=0}

loop.times{
    a,b,c = gets.split.map(&:to_i)
    h[a] += 1
    h[b] += 1
    h[c] += 1
}

h.each{|key,value|
    if value >= 2
        ans += value / 2
        h[key] = value % 2
    end 
}
puts ans + (loop*3 -ans*2)/4
0