Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Language: SQUARES
Description We are given N squares in the coordinate plane whose sides are parallel to the coordinate axes. All the corners have integer coordinates and the squares do not touch or overlap.
You are required to count the number of squares visible from the origin point O, O = (0, 0). A square is visible from the origin point O if there are two distinct points A and B on one of its sides such that the interior of the triangle OAB has no common points with any of the remaining squares. Input The first line of the input contains the integer N, 1 <= N <= 1000, the number of squares.
Each of the following N lines describes a square by specifying integers X, Y and L separated by single blank characters, 1 <= X, Y, L <= 10000. X and Y are coordinates of the lower left corner (the corner with the least X and Y coordinates) and L is the side length. Output The first and the only line of the output should contain the number of squares that are visible from the origin. Sample Input 3 2 6 3 1 4 1 3 4 1 Sample Output 3 Source |
[Submit] [Go Back] [Status] [Discuss]
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator