Beispiel #1
0
        public bool IsAlmostRightAngled()
        {
            int[] xMovement = { -1, 0, 1, 0 };
            int[] yMovement = { 0, -1, 0, 1 };
            Point a1, a2, a3;

            for (int i = 0; i < xMovement.Length; i++)
            {
                a1 = new Point(P1.X + xMovement[i], P1.Y + yMovement[i]);
                a2 = new Point(P2.X + xMovement[i], P2.Y + yMovement[i]);
                a3 = new Point(P3.X + xMovement[i], P3.Y + yMovement[i]);
                Triangle first  = new Triangle(a1, P2, P3);
                Triangle second = new Triangle(P1, a2, P3);
                Triangle third  = new Triangle(P1, P2, a3);
                if (first.IsRightAngled())
                {
                    return(true);
                }
                if (second.IsRightAngled())
                {
                    return(true);
                }
                if (third.IsRightAngled())
                {
                    return(true);
                }
            }
            return(false);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            String[] str = Console.ReadLine().Split();
            Point    p1  = new Point(Convert.ToInt32(str[0]), Convert.ToInt32(str[1]));
            Point    p2  = new Point(Convert.ToInt32(str[2]), Convert.ToInt32(str[3]));
            Point    p3  = new Point(Convert.ToInt32(str[4]), Convert.ToInt32(str[5]));
            Triangle t   = new Triangle(p1, p2, p3);

            Console.WriteLine(t.IsRightAngled() ? "RIGHT" : t.IsAlmostRightAngled() ? "ALMOST" : "NEITHER");
        }