Sorry time limit: 2000/1000 MS (Java/others) memory limit: 65536/32768 K (Java/Others)
Total submission (s): 3538 accepted submission (s): 1489
Problem description I am very sorry. I was eager to have an exercise competition. Due to my lack of preparation, there were a lot of data errors. Now I want to change to a simple question:
A few days ago, when I searched for ACM information on the Internet, I saw a middle school's Olympiad question, that is, the split plane of the non-Intersecting Curve segments. I have sent it to the Forum and lxj has come to a conclusion, not here
After talking about it, there is a similar and simpler problem:
If there are N points on the plane and there are at least two curve segments connected to each point, that is to say, each curve is closed. At the same time, we define:
1) All curve segments do not overlap;
2) but there can be multiple curve segments between any two points.
If we know that these line segments divide the plane into M parts, do you know how many curve segments there are?
Input data contains N and m, n = 0, and m = 0, which indicates that the input is over and not processed.
All input data is within the 32-bit integer range.
The number of output lines.
Sample Input
3 20 0
Sample output
3
Authorlcy
Sourceacm summer training team exercise session (1) knowledge point: Euler's formula: Number of faces + fixed points-2 = number of edges. The Code is as follows:
# Include <stdio. h> int main () {__ int64 n, m; // although the input data is within the range of 32 integers, the addition may be out of the range, use 64-bit _ int64 or long while (~ Scanf ("% i64d % i64d", & N, & M ),! (! N &&! M) {printf ("% i64d \ n", N + m-2); // simple Euler's formula, number of faces + fixed points-2 = number of edges. } Return 0 ;}
HDU 1418 (sorry) (Euler's formula, number of points, number of edges, and number of faces) (water question)