예제 #1
0
        //private static StreamWriter MockInput(string n)
        //{
        //    Inputs.SetInput("000.00" + n);
        //    var sw = new StreamWriter(@"..\..\test."+n+".out.txt");
        //    Console.SetOut(sw);
        //    return sw;
        //}

        private static void Solve(char[] input)
        {
            var n    = input.Count(x => x == '*');
            var vars = Combinatorics.GetAllVariationsWithRepetitions(n, 0, 2);

            var res = new List <string>();

            foreach (var var in vars)
            {
                string dir = "";
                int    j   = 0;
                for (int i = 0; i < input.Length; i++)
                {
                    if (input[i] == '*')
                    {
                        dir += dirs[var[j++]];
                    }
                    else
                    {
                        dir += input[i];
                    }
                }

                res.Add(dir);
            }

            res.Sort();

            Console.WriteLine(res.Count());
            foreach (var r in res)
            {
                Console.WriteLine(r);
            }
        }
예제 #2
0
        private static void Solve()
        {
            var numVars = Combinatorics.GetAllCombinationsWithoutRepetitions(n, 0, k - 1);
            var l       = letters.Length;
            var letVars = Combinatorics.GetAllVariationsWithoutRepetitions(n, 0, l - 1);

            var results = new SortedSet <string>();

            foreach (var numVar in numVars)
            {
                foreach (var letVar in letVars)
                {
                    string result = "";
                    for (int i = 0; i < numVar.Length; i++)
                    {
                        //result += $@"{numVar[i]}{letters[letVar[i]]}-";
                        result += string.Format("{0}{1}-", numVar[i], letters[letVar[i]]);
                    }

                    results.Add(result.TrimEnd(new char[] { '-' }));
                }
            }

            Console.WriteLine(results.Count);
            foreach (var result in results)
            {
                Console.WriteLine(result);
            }
        }