結果

問題 No.182 新規性の虜
ユーザー mencotton
提出日時 2017-12-29 21:10:21
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 612 bytes
コンパイル時間 964 ms
コンパイル使用メモリ 105,088 KB
実行使用メモリ 27,392 KB
最終ジャッジ日時 2024-12-21 10:36:40
合計ジャッジ時間 3,864 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25 RE * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;

namespace Test
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Array.Sort(x);
            int ret = 0;
            if (x[0] != x[1]) ret++;
            for (int i = 1; i < n - 1; i++)
            {
                if (x[i - 1] != x[i] && x[i] != x[i + 1]) ret++;
            }
            if (x[n - 2] != x[n - 1]) ret++;
            Console.WriteLine(ret);
        }
    }
}
0