結果

問題 No.182 新規性の虜
ユーザー yuki2006yuki2006
提出日時 2018-01-15 14:46:56
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,394 bytes
コンパイル時間 2,078 ms
コンパイル使用メモリ 100,728 KB
実行使用メモリ 27,620 KB
最終ジャッジ日時 2023-08-25 17:14:03
合計ジャッジ時間 5,921 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
20,864 KB
testcase_01 AC 60 ms
20,704 KB
testcase_02 AC 61 ms
22,720 KB
testcase_03 AC 60 ms
20,860 KB
testcase_04 AC 59 ms
20,728 KB
testcase_05 AC 59 ms
20,708 KB
testcase_06 AC 61 ms
20,804 KB
testcase_07 AC 62 ms
22,804 KB
testcase_08 AC 102 ms
27,496 KB
testcase_09 AC 124 ms
27,620 KB
testcase_10 AC 116 ms
27,052 KB
testcase_11 AC 106 ms
25,924 KB
testcase_12 AC 85 ms
20,440 KB
testcase_13 AC 61 ms
22,772 KB
testcase_14 AC 59 ms
20,740 KB
testcase_15 WA -
testcase_16 AC 59 ms
20,652 KB
testcase_17 AC 60 ms
20,896 KB
testcase_18 AC 107 ms
25,868 KB
testcase_19 AC 93 ms
22,420 KB
testcase_20 AC 81 ms
21,824 KB
testcase_21 AC 109 ms
25,964 KB
testcase_22 AC 88 ms
20,608 KB
testcase_23 WA -
testcase_24 AC 110 ms
26,996 KB
testcase_25 AC 100 ms
25,376 KB
testcase_26 AC 73 ms
21,508 KB
testcase_27 WA -
evil01.txt AC 124 ms
28,420 KB
evil02.txt AC 119 ms
28,524 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)
            {
                // 左端でみたときにとなりが違っていたら
                if (A[0] != A[1])
                {
                    ans++;
                }
            }
            if (N > 2)
            {
                // 右端でみたときにとなりが違っていたら
                if (A[N - 1] != A[N - 2])
                {
                    ans++;
                }
            }

            Console.WriteLine(ans);
        }

    }
}
0