Пример #1
0
        public static void Main(String[] args)
        {
            NoPointSegment solver = new NoPointSegment();

            // test case 1
            Console.WriteLine(solver.Intersection(new { 0, 0, 0, 1 }, new { 1, 0, 1, 1 }));
            // test case 2
            Console.WriteLine(solver.Intersection(new { 0, 0, 0, 1 }, new { 0, 1, 0, 2 }));
            // test case 3
            Console.WriteLine(solver.Intersection(new { 0, -1, 0, 1 }, new { -1, 0, 1, 0 }));
Пример #2
0
        public static void Main(String[] args)
        {
            string         input  = Console.ReadLine();
            NoPointSegment solver = new NoPointSegment();

            do
            {
                var segments = input.Split('|');
                var segParts = segments[0].Split(',');
                var seg1     = new int[4] {
                    int.Parse(segParts[0]), int.Parse(segParts[1]), int.Parse(segParts[2]), int.Parse(segParts[3])
                };
                segParts = segments[1].Split(',');
                var seg2 = new int[4] {
                    int.Parse(segParts[0]), int.Parse(segParts[1]), int.Parse(segParts[2]), int.Parse(segParts[3])
                };
                Console.WriteLine(solver.Intersection(seg1, seg2));
                input = Console.ReadLine();
            } while (input != "-1");
        }