Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text.RegularExpressions;
- namespace WinningNumbers
- {
- class WinningNumbers
- {
- static void Main()
- {
- string input = Console.ReadLine();
- char[] inputArray = input.ToLower().ToCharArray();
- int sum = 0;
- foreach (var item in inputArray)
- {
- sum+=Convert.ToInt32(item)-96;
- }
- List<string> collected = new List<string>();
- if (sum > 729)
- {
- Console.WriteLine("No");
- return;
- }
- else
- {
- for (int i = 111; i < 999; i++)
- {
- int[] tempNum = Array.ConvertAll(i.ToString().ToArray(), x => (int)x - 48);
- if (tempNum[0] * tempNum[1] * tempNum[2] == sum)
- {
- string num = String.Join("", tempNum.Select(p => p.ToString()).ToArray());
- collected.Add(num);
- }
- }
- }
- if (collected.Count == 0)
- {
- Console.WriteLine("No");
- return;
- }
- else
- {
- for (int k = 0, i = 0, j = 0; k < collected.Count * collected.Count; k++)
- {
- if (j == collected.Count)
- {
- i++;
- j = 0;
- Console.WriteLine(collected[i] + "-" + collected[j]);
- j++;
- }
- else
- {
- Console.WriteLine(collected[i] + "-" + collected[j]);
- j++;
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment