CF1036E.Covered Points
提高+/省选-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You are given n segments on a Cartesian plane. Each segment's endpoints have integer coordinates. Segments can intersect with each other. No two segments lie on the same line.
Count the number of distinct points with integer coordinates, which are covered by at least one segment.
给你 n 条位于笛卡尔平面上的线段。每条线段的端点坐标均为整数。线段之间可以相交。任意两条线段都不共线。
请计算被至少一条线段覆盖的、具有整数坐标的不同点的个数。
输入格式
The first line contains a single integer n (1≤n≤1000) — the number of segments.
Each of the next n lines contains four integers Axi,Ayi,Bxi,Byi (−106≤Axi,Ayi,Bxi,Byi≤106) — the coordinates of the endpoints A, B (A=B) of the i-th segment.
It is guaranteed that no two segments lie on the same line.
第一行包含一个整数 n(1≤n≤1000)—— 表示线段的数量。
接下来的 n 行,每行包含四个整数 Axi,Ayi,Bxi,Byi(−106≤Axi,Ayi,Bxi,Byi≤106)—— 分别表示第 i 条线段两个端点 A 和 B(其中 A=B)的坐标。
保证任意两条线段不共线。
输出格式
Print a single integer — the number of distinct points with integer coordinates, which are covered by at least one segment.
输出一个整数——被至少一个线段覆盖的、具有整数坐标的互异点的个数。
输入输出样例
输入#1
9 0 0 4 4 -1 5 4 0 4 0 4 4 5 2 11 2 6 1 6 7 5 6 11 6 10 1 10 7 7 0 9 8 10 -1 11 -1
输出#1
42
输入#2
4 -1 2 1 2 -1 0 1 0 -1 0 0 3 0 3 1 0
输出#2
7
说明/提示
The image for the first example:

Several key points are marked blue, the answer contains some non-marked points as well.
The image for the second example:

第一个示例的图像:

若干关键点被标为蓝色,答案中还包含一些未标记的点。
第二个示例的图像:

输入解题思路,AI测评打分。不知道怎么写?