Advertisement
kuruku

MissCat2011

Apr 14th, 2014
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.99 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. namespace MissCat2011
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int n = int.Parse(Console.ReadLine());
  14.             int cat1 = 0;
  15.             int cat2 = 0;
  16.             int cat3 = 0;
  17.             int cat4 = 0;
  18.             int cat5 = 0;
  19.             int cat6 = 0;
  20.             int cat7 = 0;
  21.             int cat8 = 0;
  22.             int cat9 = 0;
  23.             int cat10 = 0;
  24.  
  25.             for (int i = 0; i < n; i++)
  26.             {
  27.                 int vote = int.Parse(Console.ReadLine());
  28.                 if (vote == 1)
  29.                 {
  30.                     cat1++;
  31.                 }
  32.                 else if (vote == 2)
  33.                 {
  34.                     cat2++;
  35.                 }
  36.                 else if (vote == 3)
  37.                 {
  38.                     cat3++;
  39.                 }
  40.                 else if (vote == 4)
  41.                 {
  42.                     cat4++;
  43.                 }
  44.                 else if (vote == 5)
  45.                 {
  46.                     cat5++;
  47.                 }
  48.                 else if (vote == 6)
  49.                 {
  50.                     cat6++;
  51.                 }
  52.                 else if (vote == 7)
  53.                 {
  54.                     cat7++;
  55.                 }
  56.                 else if (vote == 8)
  57.                 {
  58.                     cat8++;
  59.                 }
  60.                 else if (vote == 9)
  61.                 {
  62.                     cat9++;
  63.                 }
  64.                 else if (vote == 10)
  65.                 {
  66.                     cat10++;
  67.                 }
  68.             }
  69.             int cat = 0;
  70.             int bestCat = 0;
  71.             if (cat1 > bestCat)
  72.             {
  73.                 bestCat = cat1;
  74.                 cat = 1;
  75.             }
  76.             if (cat2 > bestCat)
  77.             {
  78.                 bestCat = cat2;
  79.                 cat = 2;
  80.             }
  81.             if (cat3 > bestCat)
  82.             {
  83.                 bestCat = cat3;
  84.                 cat = 3;
  85.             }
  86.             if (cat4 > bestCat)
  87.             {
  88.                 bestCat = cat4;
  89.                 cat = 4;
  90.             }
  91.             if (cat5 > bestCat)
  92.             {
  93.                 bestCat = cat5;
  94.                 cat = 5;
  95.             }
  96.             if (cat6 > bestCat)
  97.             {
  98.                 bestCat = cat6;
  99.                 cat = 6;
  100.  
  101.             }
  102.             if (cat7 > bestCat)
  103.             {
  104.                 bestCat = cat7;
  105.                 cat = 7;
  106.  
  107.             }
  108.             if (cat8 > bestCat)
  109.             {
  110.                 bestCat = cat8;
  111.                 cat = 8;
  112.  
  113.             }
  114.             if (cat9 > bestCat)
  115.             {
  116.                 bestCat = cat9;
  117.                 cat = 9;
  118.  
  119.             }
  120.             if (cat10 > bestCat)
  121.             {
  122.                 bestCat = cat10;
  123.                 cat = 10;
  124.             }
  125.             Console.WriteLine(cat);
  126.         }
  127.     }
  128. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement