//https://www.hackerrank.com/contests/w28/challenges/the-great-xor
        public static void GreatXOR(String[] args)
        {
            Console.WriteLine("Find all a where x^a > x and a < x");
            int x = TextGui.IntegerPrompt("Enter x");

            GreatXOR_Log(x);
        }
Esempio n. 2
0
        /// <summary>
        /// Prints the digit at each place. ex "123 -> 1, 2, 3"
        /// </summary>
        public static void PlaceDigits()
        {
            Console.WriteLine("Write digit in each place.");
            int n = TextGui.IntegerPrompt("Enter n: ");

            Console.WriteLine(PlaceDigits(n));
        }
Esempio n. 3
0
        public static void Operations()
        {
            Console.WriteLine("Implement *, /, - only using addition");
            int a = TextGui.IntegerPrompt("Enter integer 1: ");
            int b = TextGui.IntegerPrompt("Enter integer 2: ");

            Console.WriteLine("{0} x {1} = {2}", a, b, Multiply(a, b));
            Console.WriteLine("{0} / {1} = {2}", a, b, Divide(a, b));
            Console.WriteLine("{0} - {1} = {2}", a, b, Subtract(a, b));
        }
Esempio n. 4
0
 public static void DivingBoard()
 {
     Console.WriteLine("Given short and long planks, you must use k plans.");
     Console.WriteLine("Find all possible lengths for the diving board.");
     maxK    = TextGui.IntegerPrompt("Enter k: ");
     shorter = TextGui.IntegerPrompt("Enter shorter: ");
     longer  = TextGui.IntegerPrompt("Enter longer: ");
     BoardPerms(0, 0);
     foreach (var b in boards)
     {
         Console.WriteLine(b);
     }
 }
Esempio n. 5
0
        /// <summary>
        /// Question 16.3 in 6th edition
        /// </summary>
        private static void IntersectingLines()
        {
            Console.WriteLine("given 2 line segments, find their intersection, if any");
            int startx1 = TextGui.IntegerPrompt("Enter line 1, start x");
            int starty1 = TextGui.IntegerPrompt("Enter line 1, start y");
            int endx1   = TextGui.IntegerPrompt("Enter line 1, end x");
            int endy1   = TextGui.IntegerPrompt("Enter line 1, end y");

            int startx2 = TextGui.IntegerPrompt("Enter line 2, start x");
            int starty2 = TextGui.IntegerPrompt("Enter line 2, start y");
            int endx2   = TextGui.IntegerPrompt("Enter line 2, end x");
            int endy2   = TextGui.IntegerPrompt("Enter line 2, end y");

            var line1 = new Line(new Point(startx1, starty1), new Point(endx1, endy1));
            var line2 = new Line(new Point(startx2, starty2), new Point(endx2, endy2));

            var intersection = Line.Intersection(line1, line2);

            Console.WriteLine("{0}, {1}", intersection.x, intersection.y);
        }