CBOJ 2023 Welcome Contest Problem 2 - Algebra Homework

Submit solution

Points: 3
Time limit: 2.0s
Memory limit: 256M

Problem types

Today in math class, you were looking at the intersection of two lines. However, after some misbehaviour, your teacher assigned \(T\) problems for you to solve. All of the problems were of the form: Find the number of intersections between \(d_1\) and \(d_2\), where \(d_1\) is the line with the equation \(y = ax + b\) and \(d_2\) is the line with the equation \(y = cx + d\).

Instead of manually solving the problems like a noob, you plan to use your newly found programming skills from ICS to solve all the problems for you.


\(1 \le T \le 100\)

\(1 \le a, b, c, d \le 5\)

Input Specification

The first line contains an integer \(T\), the number of test cases.

The next \(T\) lines contain four integers, \(a\), \(b\), \(c\), \(d\) describing one test case.

Output Specification

For each test case, output the number of intersections between \(d_1\) and \(d_2\) on a separate line. If there are an infinite number of intersections then output INFINITE.

Sample Input

3 2 3 3
1 4 1 4
1 4 4 1

Sample Output



There are no comments at the moment.