Advertisement
Guest User

Untitled

a guest
Nov 12th, 2014
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.84 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Text.RegularExpressions;
  6. using System.Threading.Tasks;
  7. using System.Numerics;
  8.  
  9. namespace Task2
  10. {
  11. class Program
  12. {
  13. static void Main()
  14. {
  15. int n = int.Parse(Console.ReadLine());
  16. int c = int.Parse(Console.ReadLine());
  17. string word = Console.ReadLine();
  18.  
  19. List<int> count = new List<int>();
  20.  
  21. int set = 0;
  22. int order=0;
  23. List<List<int>> outerList = new List<List<int>>();
  24. for (int i = 0; i < n; i++)
  25. {
  26. List<int> loopList = new List<int>();
  27. for (int k = 0; k < c; k++)
  28. {
  29. loopList.Add(int.Parse(Console.ReadLine()));
  30. }
  31. outerList.Add(loopList);
  32. }
  33. for (int i = 0; i < n; i++)
  34. {
  35. int value = 0;
  36. for (int k = 0; k < c; k++)
  37. {
  38. if (word=="even")
  39. {
  40. if (outerList[i][k] % 2 == 0)
  41. {
  42. value++;
  43. }
  44. }
  45. else if (word=="odd")
  46. {
  47. if (outerList[i][k] % 2 != 0)
  48. {
  49. value++;
  50. }
  51. }
  52.  
  53. }
  54. count.Add(value);
  55. if (set<value)
  56. {
  57. set = value;
  58. order = i;
  59. }
  60.  
  61. }
  62. if (set==0)
  63. {
  64. Console.WriteLine("No");
  65. }
  66. else if (set>0)
  67. {
  68. Console.WriteLine("{0} set has the most {2} numbers: {1}", Getpossition(order), set, word);
  69. }
  70. }
  71. static string Getpossition(int order)
  72. {
  73. string sentance =null;
  74. switch (order)
  75. {
  76. case 0: sentance = "First"; break;
  77. case 1: sentance = "Second"; break;
  78. case 2: sentance = "Third"; break;
  79. case 3: sentance = "Fourth"; break;
  80. case 4: sentance = "Fifth"; break;
  81. case 5: sentance = "Sixth"; break;
  82. case 6: sentance = "Seventh"; break;
  83. case 7: sentance = "Eighth"; break;
  84. case 8: sentance = "Ninth"; break;
  85. case 9: sentance = "Tenth"; break;
  86. }
  87.  
  88. return sentance;
  89. }
  90. }
  91. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement