Advertisement
Guest User

Untitled

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