Advertisement
G_Burlakova

MissCat2011

Mar 31st, 2014
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.21 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. class MissCat2011
  8. {
  9.     static void Main(string[] args)
  10.     {
  11.         int N = int.Parse(Console.ReadLine());
  12.         int[] cats = new int[10];
  13.         int currentVote;
  14.         for (int i = 0; i < N; i++)
  15.         {
  16.             currentVote = int.Parse(Console.ReadLine());
  17.             switch (currentVote)
  18.             {
  19.                 case 1: cats[0]++;
  20.                     break;
  21.                 case 2: cats[1]++;
  22.                     break;
  23.                 case 3: cats[2]++;
  24.                     break;
  25.                 case 4: cats[3]++;
  26.                     break;
  27.                 case 5: cats[4]++;
  28.                     break;
  29.                 case 6: cats[5]++;
  30.                     break;
  31.                 case 7: cats[6]++;
  32.                     break;
  33.                 case 8: cats[7]++;
  34.                     break;
  35.                 case 9: cats[8]++;
  36.                     break;
  37.                 case 10: cats[9]++;
  38.                     break;
  39.             }
  40.         }
  41.         int winnerNumber = Array.IndexOf(cats, cats.Max()) + 1;
  42.         Console.WriteLine(winnerNumber);
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement