結果

問題 No.182 新規性の虜
ユーザー yuki2006yuki2006
提出日時 2018-01-15 14:49:51
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,510 bytes
コンパイル時間 1,962 ms
コンパイル使用メモリ 103,200 KB
実行使用メモリ 29,088 KB
最終ジャッジ日時 2023-08-25 17:14:17
合計ジャッジ時間 5,633 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
20,580 KB
testcase_01 AC 57 ms
22,696 KB
testcase_02 AC 57 ms
20,588 KB
testcase_03 AC 58 ms
20,704 KB
testcase_04 AC 59 ms
22,636 KB
testcase_05 AC 58 ms
20,672 KB
testcase_06 AC 59 ms
20,724 KB
testcase_07 AC 59 ms
20,696 KB
testcase_08 AC 98 ms
27,460 KB
testcase_09 AC 119 ms
27,716 KB
testcase_10 AC 112 ms
29,088 KB
testcase_11 AC 103 ms
25,812 KB
testcase_12 AC 81 ms
22,424 KB
testcase_13 AC 58 ms
20,716 KB
testcase_14 AC 57 ms
22,656 KB
testcase_15 AC 56 ms
20,676 KB
testcase_16 AC 58 ms
18,536 KB
testcase_17 AC 58 ms
20,648 KB
testcase_18 AC 103 ms
25,700 KB
testcase_19 AC 92 ms
24,496 KB
testcase_20 AC 80 ms
21,712 KB
testcase_21 AC 109 ms
26,016 KB
testcase_22 AC 85 ms
22,648 KB
testcase_23 AC 55 ms
20,744 KB
testcase_24 AC 107 ms
26,948 KB
testcase_25 AC 100 ms
25,332 KB
testcase_26 AC 72 ms
21,460 KB
testcase_27 WA -
evil01.txt AC 116 ms
26,424 KB
evil02.txt AC 118 ms
30,488 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.Collections.Generic;

namespace lecture
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            string row = Console.ReadLine();
            int N = int.Parse(row);

            row = Console.ReadLine();
            // 空白区切りで一旦文字列の配列に区切る
            string[] tmp = row.Split();

            // 文字列の配列に区切ったあとに1つずつそれぞれ数値の配列に変換する
            int[] A = new int[N];
            for (int i = 0; i < N; i++)
            {
                A[i] = int.Parse(tmp[i]);
            }
            Array.Sort(A);

            int ans = 0;
            for (int i = 1; i < N - 1; i++)
            {
                if (!(A[i] == A[i - 1] || A[i] == A[i + 1]))
                {
                    ans++;
                }
            }
            if (N == 1)
            {
                ans = 1;
            }
            else if (N > 1)
            {
                // 左端でみたときにとなりが違っていたら
                if (A[0] != A[1])
                {
                    ans++;
                }
                if (N > 2)
                {
                    // 右端でみたときにとなりが違っていたら
                    if (A[N - 1] != A[N - 2])
                    {
                        ans++;
                    }
                }
            }
 

            Console.WriteLine(ans);
        }

    }
}
0