結果

問題 No.182 新規性の虜
ユーザー カルロスカルロス
提出日時 2016-05-24 14:05:53
言語 Ruby
(3.3.0)
結果
AC  
実行時間 147 ms / 5,000 ms
コード長 391 bytes
コンパイル時間 269 ms
コンパイル使用メモリ 11,292 KB
実行使用メモリ 23,148 KB
最終ジャッジ日時 2023-08-27 11:29:42
合計ジャッジ時間 5,420 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
15,136 KB
testcase_01 AC 81 ms
15,240 KB
testcase_02 AC 81 ms
15,068 KB
testcase_03 AC 83 ms
15,108 KB
testcase_04 AC 82 ms
15,132 KB
testcase_05 AC 81 ms
14,992 KB
testcase_06 AC 83 ms
15,072 KB
testcase_07 AC 82 ms
15,288 KB
testcase_08 AC 120 ms
19,416 KB
testcase_09 AC 142 ms
22,084 KB
testcase_10 AC 135 ms
20,880 KB
testcase_11 AC 129 ms
20,048 KB
testcase_12 AC 105 ms
16,840 KB
testcase_13 AC 84 ms
15,228 KB
testcase_14 AC 83 ms
15,168 KB
testcase_15 AC 83 ms
15,160 KB
testcase_16 AC 83 ms
15,196 KB
testcase_17 AC 84 ms
15,100 KB
testcase_18 AC 131 ms
20,712 KB
testcase_19 AC 116 ms
19,408 KB
testcase_20 AC 106 ms
17,320 KB
testcase_21 AC 136 ms
21,640 KB
testcase_22 AC 108 ms
17,936 KB
testcase_23 AC 81 ms
15,304 KB
testcase_24 AC 147 ms
23,148 KB
testcase_25 AC 137 ms
22,804 KB
testcase_26 AC 89 ms
15,696 KB
testcase_27 AC 80 ms
15,132 KB
evil01.txt AC 149 ms
23,640 KB
evil02.txt AC 148 ms
23,588 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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