Advertisement
Guest User

Untitled

a guest
Jul 18th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.94 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace Set
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10.  
  11. {
  12. Console.WriteLine("Enter A");
  13. string[] tokensA = Console.ReadLine().Split();
  14. HashSet<int> A = new HashSet<int>();
  15. Console.WriteLine("Enter B");
  16. string[] tokensB = Console.ReadLine().Split();
  17. HashSet<int> B = new HashSet<int>();
  18. Console.WriteLine("Enter C");
  19. string[] tokensC = Console.ReadLine().Split();
  20. HashSet<int> C = new HashSet<int>();
  21. Console.WriteLine("Enter D");
  22. string[] tokensD = Console.ReadLine().Split();
  23. HashSet<int> D = new HashSet<int>();
  24.  
  25. for (int i = 0; i < tokensA.Length; i++)
  26. {
  27. A.Add(int.Parse(tokensA[i]));
  28. }
  29. for (int i = 0; i < tokensB.Length; i++)
  30. {
  31. B.Add(int.Parse(tokensB[i]));
  32. }
  33. for (int i = 0; i < tokensC.Length; i++)
  34. {
  35. C.Add(int.Parse(tokensC[i]));
  36. }
  37. for (int i = 0; i < tokensD.Length; i++)
  38. {
  39. D.Add(int.Parse(tokensD[i]));
  40. }
  41.  
  42. if(B.IsSubsetOf(A) == true)
  43. {
  44. Console.WriteLine("AB");
  45. }
  46. if (C.IsSubsetOf(A) == true)
  47. {
  48. Console.WriteLine("AC");
  49. }
  50. if (D.IsSubsetOf(A) == true)
  51. {
  52. Console.WriteLine("AD");
  53. }
  54. if (B.IsSubsetOf(C) == true)
  55. {
  56. Console.WriteLine("CB");
  57. }
  58. if (D.IsSubsetOf(C) == true)
  59. {
  60. Console.WriteLine("CD");
  61. }
  62. if (A.IsSubsetOf(C) == true)
  63. {
  64. Console.WriteLine("CA");
  65. }
  66. if (D.IsSubsetOf(B) == true)
  67. {
  68. Console.WriteLine("BD");
  69. }
  70. if (A.IsSubsetOf(B) == true)
  71. {
  72. Console.WriteLine("BA");
  73. }
  74. if (C.IsSubsetOf(B) == true)
  75. {
  76. Console.WriteLine("BC");
  77. }
  78. if (A.IsSubsetOf(D) == true)
  79. {
  80. Console.WriteLine("DA");
  81. }
  82. if (B.IsSubsetOf(D) == true)
  83. {
  84. Console.WriteLine("DB");
  85. }
  86. if (C.IsSubsetOf(D) == true)
  87. {
  88. Console.WriteLine("DC");
  89. }
  90.  
  91. }
  92. }
  93. }
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement