Advertisement
Guest User

Untitled

a guest
May 6th, 2015
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.43 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.  
  8. class StuckNumbers
  9. {
  10.     static void Main()
  11.     {
  12.         int n = int.Parse(Console.ReadLine());
  13.         int[] nums = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
  14.         bool match = false;
  15.         for (int i1 = 0; i1 < nums.Length; i1++)
  16.         {
  17.             for (int i2 = 0; i2 < nums.Length; i2++)
  18.             {
  19.                 for (int i3 = 0; i3 < nums.Length; i3++)
  20.                 {
  21.                     for (int i4 = 0; i4 < nums.Length; i4++)
  22.                     {
  23.                         int a = nums[i1];
  24.                         int b = nums[i2];
  25.                         int c = nums[i3];
  26.                         int d = nums[i4];
  27.                         if (a != b && a != c && a != d && b != c && b != d && c != d)
  28.                         {
  29.                             String right = "" + a + b;
  30.                             String left = "" + c + d;
  31.                             if (right.Equals(left))
  32.                             {
  33.                                 Console.WriteLine(a + "|" + b + "==" + c + "|" + d);
  34.                                 match = true;
  35.                             }
  36.                         }
  37.                     }
  38.                 }
  39.             }
  40.         }
  41.         if (!match)
  42.         {
  43.             Console.WriteLine("No");
  44.         }
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement