HDU 1418 (sorry) (Euler's formula, number of points, number of edges, and number of faces) (water question)

Source: Internet
Author: User
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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.