SHARE
TWEET

02. Sets of Elements

a guest Jan 24th, 2020 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace SETS_AND_DICTIONARIES_ADVANCED
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             Dictionary<int, int> dict = new Dictionary<int, int>();
  11.             int n = int.Parse(Console.ReadLine());
  12.  
  13.             for (int i = 0; i < n; i++)
  14.             {
  15.                 int curr = int.Parse(Console.ReadLine());
  16.  
  17.                 if (!dict.ContainsKey(curr))
  18.                 {
  19.                     dict[curr] = 0;
  20.                 }
  21.                 dict[curr]++;
  22.             }
  23.             foreach (var kvp in dict)
  24.             {
  25.                 if (kvp.Value % 2 == 0)
  26.                 {
  27.                     Console.WriteLine(kvp.Key);
  28.                     break;
  29.                 }
  30.             }
  31.         }
  32.     }
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top