| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 11210 | Interval Overlap: function |
|
| 11211 | Debugger DEMO - GCD 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:
- 11210.c: the source file containing the main function which calls isIntersec().
- 11210.h: the header file which defines isIntersec() and its prototype.
- 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
- the coordinate of the left vertex
- 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.cPartial Judge Header
11210.hTags
Discuss
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.