Category
Similar Problems
0730. The Segment
Time limit : 1000 ms
Memory limit : 64 mb
The ends of the segment have integer coordinates. Find the number of points on segment with integer coordinates.
Input
Four numbers - the coordinates x1, y1, x2, y2 of the segment ends. All input numbers are not greater than 109 by the absolute value. The ends do not coincide.
Output
The required number of points.
Samples
№ |
Input |
Output |
1 |
0 0 3 3 |
4 |
2 |
1 1 2 3 |
2 |
Text from: e-olimp.com