Advertisement
Asinka

OddNumber

Nov 27th, 2012
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.85 KB | None | 0 0
  1. using System;
  2.  
  3.  
  4.  
  5. class OddNumber
  6. {
  7.     static void Main()
  8.     {
  9.         int numbers = int.Parse(Console.ReadLine());
  10.         int values = 0;
  11.         int count = 0;
  12.         int[] positive = new int[20000000];
  13.         int[] negative = new int[20000000];
  14.  
  15.         for (int i = 0; i < numbers; i++)
  16.         {
  17.             values = int.Parse(Console.ReadLine());
  18.             if (values >= 0) { positive[values]++; }
  19.             else { values = values * (-1); negative[values]++; }
  20.         }
  21.  
  22.         for (count = 0; count < 2000000; count++)
  23.         {
  24.             if (positive[count] % 2 != 0)
  25.             {
  26.                 Console.WriteLine(count);
  27.                 break;
  28.             }
  29.             if (negative[count] % 2 != 0)
  30.             {
  31.                 Console.WriteLine(-count);
  32.                 break;
  33.             }
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement