HDU 1418 (sorry) (Euler formula, fixed-point number, number of edges, number of polygons) (water problem)

Source: Internet
Author: User

I'm sorryTime limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others) Total Submission (s): 3538 Accepted Submission (s): 1489

Problem description Very sorry, originally excitedly engaged in a practice game, because I am not prepared enough, there are a lot of data errors, now here for a simple topic:

A few days ago on the internet to find ACM data, see a high School Olympiad question, is disjoint curve segment cutting plane problem, I have sent to the forum, and LXJ has got a conclusion, here is not

More than that, here's a similar and simpler question:

Assuming that there are n points on the plane, and that at least 2 curved segments of each point are connected to it, that is, each curve is closed, at the same time, we stipulate:
1) All the curved segments do not intersect;
2) It is possible to have more than one curve segment at random between two points.

Suppose we know that these line segments cut the plane into m parts, can you tell how many curved segments a joint has?

Input data including n and m,n=0,m=0 indicate the end of the input and do not process.
All input data is within a 32-bit integer range.
The output outputs the corresponding number of segments.
Sample Input
3 20 0

Sample Output
3

Authorlcy
SOURCEACM Summer Training Team Practice (a) knowledge points: Euler's formula: number of polygons + fixed-point number -2= edges. The code is as follows:
#include <stdio.h>int main () {__int64 n,m;//Although the input data is within the integer range of 32, the addition may be out of range, with 64-bit __int64 or long long while (~SCANF ( "%i64d%i64d", &n,&m),! (!n&&!m)) {printf ("%i64d\n", n+m-2);//simple Euler formula, number of polygons + fixed-point number -2= edges. }return 0;}


HDU 1418 (sorry) (Euler formula, fixed-point number, number of edges, number of polygons) (water problem)

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.