Advertisement
Guest User

Untitled

a guest
Jul 18th, 2018
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.51 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 Set
  8. {
  9. class Program
  10. {
  11. static public int Count(int[] A, int[] B,string f)
  12. {
  13. int count = 0;
  14. for (int i = 0; i < A.Length; i++)
  15. {
  16. for (int j = 0; j < B.Length; j++)
  17. {
  18. if (A[i] == B[j]) { count++; }
  19. }
  20. }
  21. if (count >= B.Length)
  22. {
  23. Console.WriteLine(f);
  24. return 0;
  25. }
  26. return 0;
  27. }
  28. static void Main(string[] args)
  29. {
  30. Console.WriteLine("Enter A");
  31. string[] tokensA = Console.ReadLine().Split();
  32. int[] A = new int[tokensA.Length];
  33. Console.WriteLine("Enter B");
  34. string[] tokensB = Console.ReadLine().Split();
  35. int[] B = new int[tokensB.Length];
  36. Console.WriteLine("Enter C");
  37. string[] tokensC = Console.ReadLine().Split();
  38. int[] C = new int[tokensC.Length];
  39. Console.WriteLine("Enter D");
  40. string[] tokensD = Console.ReadLine().Split();
  41. int[] D = new int[tokensD.Length];
  42. for (int i = 0; i < tokensA.Length; i++)
  43. {
  44. A[i] = int.Parse(tokensA[i]);
  45. }
  46. for (int i = 0; i < tokensB.Length; i++)
  47. {
  48. B[i] = int.Parse(tokensB[i]);
  49. }
  50. for (int i = 0; i < tokensC.Length; i++)
  51. {
  52. C[i] = int.Parse(tokensC[i]);
  53. }
  54. for (int i = 0; i < tokensD.Length; i++)
  55. {
  56. D[i] = int.Parse(tokensD[i]);
  57. }
  58. string[] h = { "AB", "AC", "AD", "BA", "BC", "BD", "CA", "CB", "CD", "DA", "DB", "DC" };
  59. int countAB = Count(A, C,h[0]);
  60. int countAC = Count(A, B, h[1]);
  61. int countAD = Count(A, D, h[2]);
  62. int countBA = Count(B, A, h[3]);
  63. int countBC = Count(B, C, h[4]);
  64. int countBD = Count(B, D, h[5]);
  65. int countCA = Count(C, A, h[6]);
  66. int countCB = Count(C, B, h[7]);
  67. int countCD = Count(C, D, h[8]);
  68. int countDA = Count(D, A, h[9]);
  69. int countDB = Count(D, B, h[10]);
  70. int countDC = Count(D, C, h[11]);
  71. Console.ReadLine();
  72. }
  73. }
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement