Ejemplo n.º 1
0
        public Fraction[] CalculateArray(Fraction sourceIndex, int destinationIndex)
        {
            var destinationArray = new Fraction[Util.ConvertBigIntegerToInt(_n.GetNumerator())];

            Array.Copy(_x, Util.ConvertBigIntegerToInt(sourceIndex.GetNumerator()), destinationArray, destinationIndex,
                       Util.ConvertBigIntegerToInt(_n.GetNumerator()));
            return(destinationArray);
        }
        public static Fraction[] ConvertIntToArray2(Fraction x)
        {
            int    number = ConvertBigIntegerToInt(x.GetNumerator());
            String str    = Convert.ToString(number, 2);

            return(ConvertStringToArray(str));
        }
Ejemplo n.º 3
0
        public void Run()
        {
            var code       = new List <Fraction>();
            var startIndex = new Fraction(0);

            while (startIndex.GetNumerator() < (new BigInteger(_x.Length - 1)))
            {
                var destinationArray = CalculateArray(startIndex, 0);
                var k   = CalculateK(destinationArray);
                var num = CalculateNum(destinationArray, k);
                FindBounds(num, k, out var answerI, out var answerJ);
                AddCode(code, num, answerJ);
                startIndex += _n;
            }
            Console.Out.Write("Ответ: ");
            foreach (var t in code)
            {
                Console.Out.Write(t.ToString());
            }
        }