結果

問題 No.182 新規性の虜
ユーザー yuki2006yuki2006
提出日時 2018-01-15 14:45:16
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 1,252 bytes
コンパイル時間 2,000 ms
コンパイル使用メモリ 99,892 KB
実行使用メモリ 28,916 KB
最終ジャッジ日時 2023-08-25 17:13:57
合計ジャッジ時間 6,043 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
20,652 KB
testcase_01 AC 58 ms
18,680 KB
testcase_02 AC 58 ms
20,652 KB
testcase_03 AC 58 ms
20,732 KB
testcase_04 AC 59 ms
20,640 KB
testcase_05 AC 60 ms
22,916 KB
testcase_06 AC 59 ms
20,736 KB
testcase_07 AC 60 ms
20,708 KB
testcase_08 AC 102 ms
25,424 KB
testcase_09 AC 122 ms
27,608 KB
testcase_10 AC 115 ms
26,992 KB
testcase_11 AC 106 ms
25,936 KB
testcase_12 AC 82 ms
22,432 KB
testcase_13 AC 59 ms
20,712 KB
testcase_14 AC 59 ms
20,680 KB
testcase_15 RE -
testcase_16 AC 60 ms
20,716 KB
testcase_17 AC 59 ms
18,768 KB
testcase_18 AC 105 ms
27,788 KB
testcase_19 AC 91 ms
20,400 KB
testcase_20 AC 82 ms
23,652 KB
testcase_21 AC 111 ms
28,016 KB
testcase_22 AC 88 ms
22,608 KB
testcase_23 RE -
testcase_24 AC 110 ms
28,916 KB
testcase_25 AC 102 ms
23,360 KB
testcase_26 AC 74 ms
21,568 KB
testcase_27 AC 58 ms
20,648 KB
evil01.txt AC 117 ms
28,560 KB
evil02.txt AC 119 ms
30,512 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 (A[0] != A[1])
            {
                ans++;
            }
            // 右端でみたときにとなりが違っていたら
            if (A[N - 1] != A[N - 2])
            {
                ans++;
            }

            Console.WriteLine(ans);
        }

    }
}
0