Ejemplo n.º 1
0
        public bool FindOutputNumbers(ComponentsOfSumOfSquares components)
        {
            int    number;
            double sum = components.SquaresSum;
            int    i   = 0;

            while (!ComponentsFounded(sum) && !DeterminedThatCannotGetComponents(i))
            {
                CountNumbers(ref i, ref sum);
            }

            if (ComponentsFounded(sum))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            string input;
            int    T;

            T = Console.Read();
            for (int i = 0; i < T; ++i)
            {
                input = Console.ReadLine();

                ParserStringToListOfNumbersAndCheckForTaskCondition parser = new ParserStringToListOfNumbersAndCheckForTaskCondition(input);
                if (parser.SatisfyConditions)
                {
                    ComponentsOfSumOfSquares components = new ComponentsOfSumOfSquares(parser.Numbers);
                    Helper.OutputCollection(components.OutputNumbers);
                }
                else
                {
                    Console.WriteLine(parser.Warning);
                }
            }
        }