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.Threading.Tasks;
- namespace Set
- {
- class Program
- {
- static public int Count(int[] A, int[] B,string f)
- {
- int count = 0;
- for (int i = 0; i < A.Length; i++)
- {
- for (int j = 0; j < B.Length; j++)
- {
- if (A[i] == B[j]) { count++; }
- }
- }
- if (count >= B.Length)
- {
- Console.WriteLine(f);
- return 0;
- }
- return 0;
- }
- static void Main(string[] args)
- {
- Console.WriteLine("Enter A");
- string[] tokensA = Console.ReadLine().Split();
- int[] A = new int[tokensA.Length];
- Console.WriteLine("Enter B");
- string[] tokensB = Console.ReadLine().Split();
- int[] B = new int[tokensB.Length];
- Console.WriteLine("Enter C");
- string[] tokensC = Console.ReadLine().Split();
- int[] C = new int[tokensC.Length];
- Console.WriteLine("Enter D");
- string[] tokensD = Console.ReadLine().Split();
- int[] D = new int[tokensD.Length];
- for (int i = 0; i < tokensA.Length; i++)
- {
- A[i] = int.Parse(tokensA[i]);
- }
- for (int i = 0; i < tokensB.Length; i++)
- {
- B[i] = int.Parse(tokensB[i]);
- }
- for (int i = 0; i < tokensC.Length; i++)
- {
- C[i] = int.Parse(tokensC[i]);
- }
- for (int i = 0; i < tokensD.Length; i++)
- {
- D[i] = int.Parse(tokensD[i]);
- }
- string[] h = { "AB", "AC", "AD", "BA", "BC", "BD", "CA", "CB", "CD", "DA", "DB", "DC" };
- int countAB = Count(A, C,h[0]);
- int countAC = Count(A, B, h[1]);
- int countAD = Count(A, D, h[2]);
- int countBA = Count(B, A, h[3]);
- int countBC = Count(B, C, h[4]);
- int countBD = Count(B, D, h[5]);
- int countCA = Count(C, A, h[6]);
- int countCB = Count(C, B, h[7]);
- int countCD = Count(C, D, h[8]);
- int countDA = Count(D, A, h[9]);
- int countDB = Count(D, B, h[10]);
- int countDC = Count(D, C, h[11]);
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement