結果

問題 No.182 新規性の虜
ユーザー huffman56
提出日時 2022-10-30 12:06:42
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 91 ms / 5,000 ms
コード長 727 bytes
コンパイル時間 794 ms
コンパイル使用メモリ 110,252 KB
実行使用メモリ 39,280 KB
最終ジャッジ日時 2024-07-07 04:51:57
合計ジャッジ時間 3,222 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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;
using System.Linq;

namespace SortItems
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var nums = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Array.Sort(nums);
            var d = new Dictionary<int, int>();

            for (var i = 0; i < n; i++)
            {
                if (d.ContainsKey(nums[i]))
                {
                    d[nums[i]]++;
                }
                else
                {
                    d[nums[i]] = 1;
                }
            }

            Console.WriteLine(d.Count(x => x.Value == 1));

        }
    }
}
0