1046 - I2P CS 2016 Lee HW week6 Scoreboard

Time

2016/10/19 12:00:00 2016/10/24 17:30:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
11153 Day Number of the Year Calculator
11151 rectangle intersection

11153 - Day Number of the Year Calculator   

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




11151 - rectangle intersection   

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

  1. the x coordinate of the bottom-left vertex
  2. the y coordinate of the bottom-left vertex
  3. the width (the length of the edge that is parallel to the x-axis), positive
  4. 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.

Sample Input  Download

Sample Output  Download

Tags

Lee Homework



Discuss