Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Text.RegularExpressions;
- using System.Threading.Tasks;
- using System.Numerics;
- namespace Task2
- {
- class Program
- {
- static void Main()
- {
- int n = int.Parse(Console.ReadLine());
- int c = int.Parse(Console.ReadLine());
- string word = Console.ReadLine();
- List<int> count = new List<int>();
- int set = 0;
- int order=0;
- List<List<int>> outerList = new List<List<int>>();
- for (int i = 0; i < n; i++)
- {
- List<int> loopList = new List<int>();
- for (int k = 0; k < c; k++)
- {
- loopList.Add(int.Parse(Console.ReadLine()));
- }
- outerList.Add(loopList);
- }
- for (int i = 0; i < n; i++)
- {
- int value = 0;
- for (int k = 0; k < c; k++)
- {
- if (word=="even")
- {
- if (outerList[i][k] % 2 == 0)
- {
- value++;
- }
- }
- else if (word=="odd")
- {
- if (outerList[i][k] % 2 != 0)
- {
- value++;
- }
- }
- }
- count.Add(value);
- if (set<value)
- {
- set = value;
- order = i;
- }
- }
- if (set==0)
- {
- Console.WriteLine("No");
- }
- else if (set>0)
- {
- Console.WriteLine("{0} set has the most {2} numbers: {1}", Getpossition(order), set, word);
- }
- }
- static string Getpossition(int order)
- {
- string sentance =null;
- switch (order)
- {
- case 0: sentance = "First"; break;
- case 1: sentance = "Second"; break;
- case 2: sentance = "Third"; break;
- case 3: sentance = "Fourth"; break;
- case 4: sentance = "Fifth"; break;
- case 5: sentance = "Sixth"; break;
- case 6: sentance = "Seventh"; break;
- case 7: sentance = "Eighth"; break;
- case 8: sentance = "Ninth"; break;
- case 9: sentance = "Tenth"; break;
- }
- return sentance;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement