ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Разделы > Геометрия > задача:


50327 - Parallel Lines

Гость
• Вопросы к жюри (2)

Задачи раздела

• 50664 - Polygons
• 50263 - Points
• 50268 - Triangles
• 50663 - Lights
• 50670 - Picture
• 51041 - Plane Segmentation
• 50422 - Area and Perimeter of diffe...
• 50473 - Counting Circles Positions
• 50327 - Parallel Lines
• 50362 - Pythagorean Numbers
• 50328 - How far away
• 50397 - The Number of Points in a ...
• 50399 - Mobile Base Station
• 50487 - Radius of Inscribed Circle
• 50480 - What quadrant is it?
• 50825 - Drawing Polygon
• 50508 - The Biggest Area

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Prepared by Ibrahim Mesecan.

Parallel Lines

Mr. Erind, school math teacher, has a list of lines in a file and he wants to see the number of parallel lines.

Two line segments are said to be parallel if their slopes are equal. The slope of a line can be calculated with the following formula:
                (y2-y1)
    slope = m = -------
                (x2-x1)

Note: Pay attention to the condition when x1==x2, the program cannot calculate the slope because it will give division by zero error.

Question:
Write a program that is going to get x and y coordinates of a line segment. And then, the program will compare that line to the other line segments. At the end, the program is going to show the number of parallel lines with the first line segment.

Input specification
First, you will be given the x y coordinates of the first line segment (x1, y1, x2, y2) where x1 and y1 are the coordinates of the start point and x2, y2 are the coordinates of the end point of the first line segment. Then, you will be given a number (n), the number of following line segments. The following n lines will have four integers each (x1, y1, x2, y2) where x, y coordinates are integers between -10000 and 10000 and 1 < n ≤ 5000

Output specification
Show the number of parallel line segments with the first line segment

Sample Input I
  1 1 2 2
  4
  4 5 4 6
  3 3 5 5
  4 4 2 2
  1 5 2 9
Sample Output I
  2

Output Explanation :
  Only the line segments, (3 3 5 5) and (4 4 2 2) are parallel to (1 1 2 2).


Для отправки решений необходимо выполнить вход.

www.contester.ru