Advertisement
Statev

MissCat201_notArray

Nov 30th, 2011
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.34 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _2b.MissCat201_notArray
  4. {
  5.     class MissCat201_notArray
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             uint n = uint.Parse(Console.ReadLine());
  10.             int cat1 = 0;
  11.             int cat2 = 0;
  12.             int cat3 = 0;
  13.             int cat4 = 0;
  14.             int cat5 = 0;
  15.             int cat6 = 0;
  16.             int cat7 = 0;
  17.             int cat8 = 0;
  18.             int cat9 = 0;
  19.             int cat10 = 0;
  20.             byte choice;
  21.             for (int i = 0; i < n; i++)
  22.             {
  23.                 choice = byte.Parse(Console.ReadLine());
  24.                 switch (choice)
  25.                 {
  26.                     case 1: cat1++; break;
  27.                     case 2: cat2++; break;
  28.                     case 3: cat3++; break;
  29.                     case 4: cat4++; break;
  30.                     case 5: cat5++; break;
  31.                     case 6: cat6++; break;
  32.                     case 7: cat7++; break;
  33.                     case 8: cat8++; break;
  34.                     case 9: cat9++; break;
  35.                     case 10: cat10++; break;
  36.                 }
  37.             }
  38.             byte missCat = 1;
  39.             int maxVote = cat1;
  40.             if (cat2 > maxVote)
  41.             {
  42.                 maxVote = cat2;
  43.                 missCat = 2;
  44.             }
  45.             if (cat3 > maxVote)
  46.             {
  47.                 maxVote = cat3;
  48.                 missCat = 3;
  49.             }
  50.             if (cat4 > maxVote)
  51.             {
  52.                 maxVote = cat4;
  53.                 missCat = 4;
  54.             }
  55.             if (cat5 > maxVote)
  56.             {
  57.                 maxVote = cat5;
  58.                 missCat = 5;
  59.             }
  60.             if (cat6 > maxVote)
  61.             {
  62.                 maxVote = cat6;
  63.                 missCat = 6;
  64.             }
  65.             if (cat7 > maxVote)
  66.             {
  67.                 maxVote = cat7;
  68.                 missCat = 7;
  69.             }
  70.             if (cat8 > maxVote)
  71.             {
  72.                 maxVote = cat8;
  73.                 missCat = 8;
  74.             }
  75.             if (cat9 > maxVote)
  76.             {
  77.                 maxVote = cat9;
  78.                 missCat = 9;
  79.             }
  80.             if (cat10 > maxVote)
  81.             {
  82.                 maxVote = cat10;
  83.                 missCat = 10;
  84.             }
  85.             Console.WriteLine(missCat);
  86.         }
  87.     }
  88. }
  89.  
  90.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement