結果

問題 No.182 新規性の虜
ユーザー カルロス
提出日時 2016-05-24 14:05:53
言語 Ruby
(3.4.1)
結果
AC  
実行時間 153 ms / 5,000 ms
コード長 391 bytes
コンパイル時間 575 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 20,096 KB
最終ジャッジ日時 2024-12-27 04:50:56
合計ジャッジ時間 5,124 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.to_i
data = gets.split.map(&:to_i).sort
novelty = 0

(0..n-1).each{|i|
    if i==0
        if data[i]!=data[i+1]
            novelty = novelty + 1
        end
    elsif i==n-1
        if data[i]!=data[i-1]
            novelty = novelty + 1
        end
    else
        if data[i]!=data[i+1] && data[i]!=data[i-1]
            novelty = novelty + 1
        end
    end
}
puts novelty
0