CF21B.Intersection

普及+/提高

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You are given two set of points. The first set is determined by the equation A_1_x + B_1_y + _C_1 = 0, and the second one is determined by the equation A_2_x + B_2_y + _C_2 = 0.

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

给你两组点。第一组点由方程 A1x+B1y+C1=0A_1x + B_1y + C_1 = 0 确定,第二组点由方程 A2x+B2y+C2=0A_2x + B_2y + C_2 = 0 确定。

请编写一个程序,求出这两个给定点集交集中点的个数。

输入格式

The first line of the input contains three integer numbers _A_1, _B_1, _C_1 separated by space. The second line contains three integer numbers _A_2, _B_2, _C_2 separated by space. All the numbers are between -100 and 100, inclusive.

输入的第一行包含三个用空格分隔的整数 A1A_1、B1B_1、C1C_1。第二行包含三个用空格分隔的整数 A2A_2、B2B_2、C2C_2。所有数字均在 −100-100 到 100100 之间(含端点)。

输出格式

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

输出交集中点的数量,如果交集中有无穷多个点,则输出 −1-1。

输入输出样例

  • 输入#1

    1 1 0
    2 2 0

    输出#1

    -1
  • 输入#2

    1 1 0
    2 -2 0

    输出#2

    1

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

首页