TutOnEqua - Tutoring on equations
Dữ liệu vào: standard input
Dữ liệu ra: standard output
Giới hạn thời gian: 1.0 giây
Giới hạn bộ nhớ: 256 megabyte
Đăng bởi: chandoi

Nguồn: ACM-ICPC Vietnam Central Provincial Contest  

Chú ý: bộ test do mình make(có thể có lỗi), không phải bộ test chính thức của kì thi

 

Yen has a math exam coming next week. To help her prepare for the exam, Trung set up a bunch of equations for her to practice solving. These equations has the form:

(a1*x+b1)*(a2*x+b2)...(an*x+bn) = 0

Trung wants to check how many different distinct solutions do these equation have.

Input

The input starts with an integer T - the number of tests. Then T tests follow. For each test:

    •    The first line is the number n.

    •    In the next N lines, the i-th line has 2 integers ai, bi. (-100 <= ai, bi <= 100; ai or bi is non-zero)

Output

For each test in the input, print the number of distinct solutions to the equation.

Ví dụ

  • input
    1
    4
    0 2
    1 2
    2 4
    3 5
    output
    2

The equation is 2*(x + 2)*(2x + 4)*(3x + 5) = 0

Back to Top