結果

問題 No.182 新規性の虜
ユーザー ooh_20
提出日時 2018-01-15 10:57:58
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 76 ms / 5,000 ms
コード長 1,064 bytes
コンパイル時間 3,766 ms
コンパイル使用メモリ 104,064 KB
実行使用メモリ 32,384 KB
最終ジャッジ日時 2024-12-27 20:39:45
合計ジャッジ時間 3,567 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます
コンパイルメッセージ
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();

            Dictionary<string, int> novelty = new Dictionary<string, int>();

            for (int i = 0; i < N; i++)
            {
                string number = tmp[i];
                if (novelty.ContainsKey(number))
                {
                    novelty[number]++;
                }
                else
                {
                    novelty[number] = 1;
                }
            }

            int noveltyCnt = 0;
            foreach (int cnt in novelty.Values)
            {
                if (cnt == 1)
                {
                    noveltyCnt++;
                }
            }

            Console.WriteLine(noveltyCnt);
        }
    }
}
0