結果

問題 No.182 新規性の虜
ユーザー yuki2006yuki2006
提出日時 2018-01-15 14:20:44
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 123 ms / 5,000 ms
コード長 1,221 bytes
コンパイル時間 2,175 ms
コンパイル使用メモリ 100,252 KB
実行使用メモリ 29,104 KB
最終ジャッジ日時 2023-08-27 17:04:15
合計ジャッジ時間 6,027 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
20,700 KB
testcase_01 AC 61 ms
20,692 KB
testcase_02 AC 60 ms
20,640 KB
testcase_03 AC 61 ms
20,724 KB
testcase_04 AC 61 ms
18,700 KB
testcase_05 AC 62 ms
22,740 KB
testcase_06 AC 60 ms
20,692 KB
testcase_07 AC 60 ms
20,724 KB
testcase_08 AC 104 ms
27,508 KB
testcase_09 AC 123 ms
27,592 KB
testcase_10 AC 116 ms
29,104 KB
testcase_11 AC 107 ms
25,880 KB
testcase_12 AC 84 ms
22,388 KB
testcase_13 AC 60 ms
22,752 KB
testcase_14 AC 60 ms
20,716 KB
testcase_15 AC 59 ms
22,744 KB
testcase_16 AC 61 ms
20,648 KB
testcase_17 AC 60 ms
22,744 KB
testcase_18 AC 107 ms
25,664 KB
testcase_19 AC 95 ms
22,516 KB
testcase_20 AC 85 ms
19,696 KB
testcase_21 AC 113 ms
26,076 KB
testcase_22 AC 89 ms
22,716 KB
testcase_23 AC 59 ms
20,864 KB
testcase_24 AC 112 ms
28,940 KB
testcase_25 AC 103 ms
23,400 KB
testcase_26 AC 76 ms
23,640 KB
testcase_27 AC 61 ms
20,636 KB
evil01.txt AC 121 ms
28,544 KB
evil02.txt AC 122 ms
30,564 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 = 0; i < N; i++)
            {
                if (i > 0 && A[i] == A[i - 1]){
                    // 左隣が同じだったら何もしない。
                }else if (i<N-1 && A[i] == A[i + 1]){                    
                    // 右隣が同じだったら何もしない。
                }else{
                    // どちらかの隣がA[i]と同じではなかったら
                    ans++;
                }

            }
            Console.WriteLine(ans);
        }

    }
}
0