結果

問題 No.182 新規性の虜
ユーザー しらゆきしらゆき
提出日時 2015-11-19 09:06:11
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 118 ms / 5,000 ms
コード長 606 bytes
コンパイル時間 2,050 ms
コンパイル使用メモリ 102,624 KB
実行使用メモリ 30,976 KB
最終ジャッジ日時 2023-08-27 07:41:13
合計ジャッジ時間 5,989 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
23,816 KB
testcase_01 AC 59 ms
23,540 KB
testcase_02 AC 59 ms
21,604 KB
testcase_03 AC 59 ms
21,644 KB
testcase_04 AC 59 ms
23,692 KB
testcase_05 AC 61 ms
21,664 KB
testcase_06 AC 60 ms
21,680 KB
testcase_07 AC 58 ms
21,692 KB
testcase_08 AC 99 ms
28,488 KB
testcase_09 AC 118 ms
28,524 KB
testcase_10 AC 111 ms
28,232 KB
testcase_11 AC 104 ms
25,012 KB
testcase_12 AC 85 ms
25,448 KB
testcase_13 AC 60 ms
19,556 KB
testcase_14 AC 61 ms
21,720 KB
testcase_15 AC 59 ms
21,744 KB
testcase_16 AC 60 ms
21,656 KB
testcase_17 AC 61 ms
21,612 KB
testcase_18 AC 105 ms
28,632 KB
testcase_19 AC 93 ms
23,416 KB
testcase_20 AC 86 ms
22,712 KB
testcase_21 AC 109 ms
30,976 KB
testcase_22 AC 84 ms
23,632 KB
testcase_23 AC 58 ms
23,840 KB
testcase_24 AC 110 ms
27,816 KB
testcase_25 AC 104 ms
26,384 KB
testcase_26 AC 73 ms
22,508 KB
testcase_27 AC 58 ms
21,704 KB
evil01.txt AC 112 ms
29,444 KB
evil02.txt AC 112 ms
29,416 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Linq;

class Program
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();

        Array.Sort(a);
        int cnt = 0;

        for (int i = 0; i < n - 2; i++)
        {
            if (a[i] != a[i + 1] && a[i + 1] != a[i + 2])
            {
                cnt++;
            }
        }

        if (n != 1)
        {
            if (a[0] != a[1]) cnt++;
            if (a[n - 2] != a[n - 1]) cnt++;
        }
        else cnt++;
        
        Console.WriteLine(cnt);
    }
}
0