3883.Intersection

Time Limit: 1s Memory Limit: 256MB

You are given two set of points. The first set is determined by the equation A1x+B1y+C1=0, and the second one is determined by the equation A2x+B2y+C2=0.

Write the program which finds the number of points in the intersection of two given sets.

Input Format(From the terminal/stdin)

The first line of the input contains three integer numbers A1,B1,C1 separated by space. The second line contains three integer numbers A2,B2,C2 separated by space. All the numbers are between -100 and 100, inclusive.

Output Format(To the terminal/stdout)

Print the number of points in the intersection or -1 if there are infinite number of points.

Sample Input 1

Copy
1 1 0
2 2 0
 · · \n
 · · \n

Sample Output 1

Copy
-1
  \n

Sample Input 2

Copy
1 1 0
2 -2 0
 · · \n
 ·  · \n

Sample Output 2

Copy
1
 \n

Submit

请先 登录

© 2025 FAQs