1069 - I2P CS 2016 Lee Lab4 Scoreboard

Time

2016/11/14 15:50:00 2016/11/14 17:30:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
11210 Interval Overlap: function
11211 Debugger DEMO - GCD Function

11210 - Interval Overlap: function   

Description

In this problem, we define an interval [a..b] as a continuous one-dimensional area form number a to b.

You are asked to calculate the number of interval pairs that overlap each other among a set of given intervals.  All intervals are located in a number line, and all their endpoints are integers.

This problem involves three parts:

  1. 11210.c: the source file containing the main function which calls isIntersec().
  2. 11210.h: the header file which defines isIntersec() and its prototype.
  3. Your answer as a C source file, in which you should implement the isIntersec() function, and the function only.

Input

The first line contains one number N, where 2 <= N <= 256, standing for the number of given intervals.

Each of the following N lines describes an interval and has 2 integers separated by space, representing

  1. the coordinate of the left vertex
  2. the coordinate of the right vertex

For each interval, you may assume the coordinate of the left vertex is smaller than the one of the right vertex.

Notice that each of the 2 numbers is representable by an int type in C language.

Output

The output should contain only one number, representing the number of interval pairs that intersect to each other.

Notice that if the overlapping part is of zero length, then the pair should NOT count.

Sample Input  Download

Sample Output  Download

Partial Judge Code

11210.c

Partial Judge Header

11210.h

Tags




Discuss




11211 - Debugger DEMO - GCD Function   

Description

This problem is for you guys to demonstrate the usage of debugger. You are not required to submit any code to make this problem "Accepted". JUST download the codes we provided, and make them work in your development environment.

The task is simple: you are given 2 functions, and both of them will return the Greatest Common Divisor (GCD) of 2 given positive integers. You need to insert the break point to the codes, and explain how these codes work.

Input

There are 2 positive integers, separated by a space, as the input.

Output

Print the Greatest Common Divisor for both functions. You do not have to worry about the format.

Sample Input  Download

Sample Output  Download

Partial Judge Code

11211.c

Partial Judge Header

11211.h

Tags




Discuss