| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 11153 | Day Number of the Year Calculator |
|
| 11151 | rectangle intersection |
|
Description
Input a certain date, calculate the nth day of the year.
Input
The inputs consists of 3 parts:
year month day
0<year<3000
Output
Output is the day number of the year. Note that you do not need to print‘\n’ at the end of the output.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
According to Wikipedia, the definition of rectangle is as follows: "In Euclidean plane geometry, a rectangle is a quadrilateral(四邊形) with four right angles(直角). It can also be defined as an equiangular quadrilateral, since equiangular means that all of its angles are equal (360°/4 = 90°)."
In this problem, you are asked to calculate the number of rectangle pairs that intersect to each other among a set of given rectangles. All rectangles are located in a 2-dimensional euclidean space(二維空間), and all their edges are parallel to either the X- or the Y-axis.
Input
The first line contains one number N, where 2 <= N <= 128, standing for the number of given rectangles.
Each of the following N lines describes a rectangle and has 4 integers separated by space, representing
- the x coordinate of the bottom-left vertex
- the y coordinate of the bottom-left vertex
- the width (the length of the edge that is parallel to the x-axis), positive
- the height (the length of the edge that is parallel to the y-axis), positive
Notice that each of the 4 numbers is representable by an int type in C language.
Output
The output should contain only one number, representing the number of rectangle pairs that intersect to each other.
Notice that if the area of overlapping part is zero, then the pair should NOT count.