Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class MorseCodeNums
- {
- static void Main()
- {
- string input = Console.ReadLine();
- int[] inputInt = new int[input.Length];
- int nSum = 0;
- int matchings = 0;
- for (int i = 0; i < input.Length; i++)
- {
- inputInt[i] = Convert.ToInt32(input[i].ToString());
- nSum += inputInt[i];
- }
- int morseCodeProduct = 0;
- for (int i1 = 0; i1 < 6; i1++)
- {
- for (int i2 = 0; i2 < 6; i2++)
- {
- for (int i3 = 0; i3 < 6; i3++)
- {
- for (int i4 = 0; i4 < 6; i4++)
- {
- for (int i5 = 0; i5 < 6; i5++)
- {
- for (int i6 = 0; i6 < 6; i6++)
- {
- morseCodeProduct = i1 * i2 * i3 * i4 * i5 * i6;
- if (morseCodeProduct == nSum)
- {
- Console.Write(new string('.', i1));
- Console.Write(new string('-', 5 - i1));
- Console.Write("|");
- Console.Write(new string('.', i2));
- Console.Write(new string('-', 5 - i2));
- Console.Write("|");
- Console.Write(new string('.', i3));
- Console.Write(new string('-', 5 - i3));
- Console.Write("|");
- Console.Write(new string('.', i4));
- Console.Write(new string('-', 5 - i4));
- Console.Write("|");
- Console.Write(new string('.', i5));
- Console.Write(new string('-', 5 - i5));
- Console.Write("|");
- Console.Write(new string('.', i6));
- Console.Write(new string('-', 5 - i6));
- Console.Write("|");
- Console.WriteLine();
- matchings++;
- }
- }
- }
- }
- }
- }
- }
- if (matchings == 0)
- {
- Console.WriteLine("No");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement