Advertisement
Guest User

Untitled

a guest
May 4th, 2015
447
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.40 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 StuckNumbers_9
  8. {
  9.     class StuckNumbers_9
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string numInput = Console.ReadLine();
  14.             List<int> numbers = numInput.Split().Select(int.Parse).ToList();
  15.             bool isResult = false;
  16.  
  17.             foreach (int a in numbers)
  18.             {
  19.                 foreach (int b in numbers)
  20.                 {
  21.                     foreach (int c in numbers)
  22.                     {
  23.                         foreach (int d in numbers)
  24.                         {
  25.                             if (a != b && a != c && a != d && b != c && b != d && c != d)
  26.                             {
  27.                                 string leftSide = "" + a + b;
  28.                                 string rightSide = "" + c + d;
  29.                                 if (leftSide.Equals(rightSide))
  30.                                 {
  31.                                     isResult = true;
  32.                                     Console.WriteLine("{0}|{1}=={2}|{3}", a, b, c, d);
  33.                                 }
  34.                             }
  35.                         }
  36.                     }
  37.                 }
  38.             }
  39.             if (!isResult)
  40.             {
  41.                 Console.WriteLine("No");
  42.             }
  43.         }
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement