Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class MorseCodeNumbers
- {
- static void Main()
- {
- int n = int.Parse(Console.ReadLine());
- string[] morse = {"-----", ".----", "..---", "...--", "....-", "....." };
- int nSum = 0;
- int count = 0;
- int product = 0;
- string c = "|";
- for (int i = 0; i < 4; i++)
- {
- nSum += n % 10;
- n = n / 10;
- }
- for (int i0 = 0; i0 < 6; i0++)
- {
- 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++)
- {
- product = i0 * i1 * i2 * i3 * i4 * i5;
- if (product == nSum)
- {
- string output = morse[i0] + c + morse[i1] + c + morse [i2] + c + morse[i3] + c + morse[i4] + c + morse[i5] + c;
- Console.WriteLine(output.Trim());
- count++;
- }
- }
- }
- }
- }
- }
- }
- if (count == 0)
- {
- Console.WriteLine("No");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement