Sgu-135-drawing Lines (simple math!) )

Source: Internet
Author: User

SGU-135Drawing Lines
Time Limit: 250MS Memory Limit: 4096KB 64bit IO Format: %i64d &%i64u

Submit Status

Description

Little Johnny likes to draw a lot. A few days ago he painted lots of straight lines in his sheet of paper. Then he counted on how many zones the sheet of paper is split by these lines. He noticed that this number was not always the same. For instance, if he draws 2 lines, the sheet of paper could is split into 4, 3 or even 2 3> (if the lines is identical) zones. Since He's a very curious kid, he would like to know which are the maximum number of zones into which he can split the she Et of paper, if he draws N lines. The sheet of paper is to be considered a very large (=infinite) rectangle.

Input

The input file would contain an integer number: N (0<=n<=65535).

Output

You should output one integer:the maximum number of zones to which the sheet of paper can be split if Johnny draws N lines.

Sample Input #1

0

Sample Output #1

1

Sample Input #2

1

Sample Output #2

2
Author : Mugurel Ionut Andreica
Resource : Ssu::online contester Fall Contest #2
Date : Fall 2002

Source



is also a mathematical problem, to find the regular.


Rule: 1,2,4,7,11,16 ... A (n) = N (n+1)/2+1; (n starting from 0)


AC Code:




Sgu-135-drawing Lines (simple math!) )

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.