Advertisement
Guest User

Untitled

a guest
Oct 12th, 2015
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.60 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Threading;
  5.  
  6. class StuckNumbers
  7. {
  8.     static void Main(string[] args)
  9.     {
  10.  
  11.         int k = int.Parse(Console.ReadLine());
  12.         string[] arrayNumbers = new string[k];
  13.         arrayNumbers = Console.ReadLine().Trim().Split(' ').ToArray();
  14.         bool isTrue = false;
  15.  
  16.         for (int aIndex = 0; aIndex < arrayNumbers.Length; aIndex++)
  17.         {
  18.             for (int bIndex = 0; bIndex < arrayNumbers.Length; bIndex++)
  19.             {
  20.                 for (int cIndex = 0; cIndex < arrayNumbers.Length; cIndex++)
  21.                 {
  22.                     for (int dIndex = 0; dIndex < arrayNumbers.Length; dIndex++)
  23.                     {
  24.                         string a = arrayNumbers[aIndex];
  25.                         string b = arrayNumbers[bIndex];
  26.                         string c = arrayNumbers[cIndex];
  27.                         string d = arrayNumbers[dIndex];
  28.  
  29.                         if (a != b && a != c && a != d && b != d && b != c && c != d)
  30.                         {
  31.                             string firstPart = a + b;
  32.                             string secondPart = c + d;
  33.                             if (firstPart == secondPart)
  34.                             {
  35.                                 Console.WriteLine("{0}|{1}=={2}|{3}", a, b, c, d);
  36.                                 isTrue = true;
  37.                             }
  38.                         }
  39.                     }
  40.                 }
  41.             }
  42.         }
  43.         if (!isTrue)
  44.         {
  45.             Console.WriteLine("No");
  46.         }
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement