Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- class MorseCodeNumbers
- {
- static void Main()
- {
- int n = int.Parse(Console.ReadLine());
- int nSum = (n % 10) + ((n % 100) / 10) +
- ((n % 1000) / 100) + (n / 1000);
- Dictionary<int, string> nums = new Dictionary<int,string>();
- {
- nums[0] = "-----|";
- nums[1] = ".----|";
- nums[2] = "..---|";
- nums[3] = "...--|";
- nums[4] = "....-|";
- nums[5] = ".....|";
- }
- bool check = false;
- for (int num1 = 0; num1 <= 5; num1++)
- {
- for (int num2 = 0; num2 <= 5; num2++)
- {
- for (int num3 = 0; num3 <= 5; num3++)
- {
- for (int num4 = 0; num4 <= 5; num4++)
- {
- for (int num5 = 0; num5 <= 5; num5++)
- {
- for (int num6 = 0; num6 <= 5; num6++)
- {
- if (num1 * num2 * num3 * num4
- * num5 * num6 == nSum)
- {
- Console.WriteLine("{0}{1}{2}{3}{4}{5}",
- nums[num1], nums[num2], nums[num3],
- nums[num4], nums[num5], nums[num6]);
- check = true;
- }
- }
- }
- }
- }
- }
- }
- if (!check)
- {
- Console.WriteLine("No");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement