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

Турниры > CEN112 Homeworks 2013-2015 > задача:


12-Spr1-40. 50327 - Parallel Lines

CEN112 Homeworks 2013-2015

Старт: 15.дек.2013 в 12:00:00
Финиш: 15.дек.2013 в 17:00:00
Турнир завершён!
• Турнирная таблица

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

Задачи турнира

• 50530 - Sum of Ratios
• 50375 - Area of Circles
• 50388 - Number of Armstrong Num...
• 50393 - Palindromic Numbers
• 50339 - The Largest Rectangle
• 50345 - Orders
• 50758 - National Elections - Revisited
• 50754 - Team Standings
• 12-Spr1-40. 50327 - Parallel Lines
• 13-Fall2-20. 50395 - Page "Like" Av...
• 14-Spr1-30. 50492 - Contest Score...
• 14-Spr1-40. 50538 - Sum of kth Dia...
• 14-Spr1-60. 50647 - Спираль
• 14-Spr2-20. 50442 - Polynomial Add...
• 14-Spr2-40. 50361 - Align Two Lists
• 14-Spr2-50. 50616 - Змейка
• 14-Spr2-60. 50444 - n digit kth nu...

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

Если у вас есть предложения или пожелания по работе 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