
ZOJ Problem Set  2967
Evelyn likes drawing very much. Today, she draws lots of rainbows on white paper of infinite size, each using a different color. Since there're too many rainbows now, she wonders, how many of them can be seen? For simplicity, each rainbow L_{i} is represented as a nonvertical line specified by the equation: y=a_{i}x+b_{i}. A rainbow L_{i} can be seen if there exists some xcoordinate x_{0} at which, its ycoordinate is strictly greater than ycoordinates of any other rainbows: a_{i}x_{0}+b_{i} > a_{j}x_{0}+b_{j} for all j != i. Now, your task is, given the set of rainbows drawn, figure out the number of rainbows that can be seen. Input Standard input will contain multiple test cases. The first line of the input is a single integer T (1 <= T <= 60) which is the number of test cases. And it will be followed by T consecutive test cases. There's a blank line before every case. In each test case, there will first be an integer n (1 <= n <= 5000), which is the number of rainbows. Then n consecutive real number pairs follow. Each pair contains two real numbers, a_{i} and b_{i}, representing rainbow L_{i}: y=a_{i}x+b_{i}. No two rainbows will be the same, that is to say, have the same a and b. Output Results should be directed to standard output. The output of each test case should be a single integer, which is the number of rainbows that can be seen. Sample Input2 1 1 1 3 1 0 2 0 3 0Sample Output 1 2 Author: DAI, Wenbin Source: The 5th Zhejiang Provincial Collegiate Programming Contest 