UVa 10213 How Many Pieces the land? (Math & Euler formula & high Precision)

Source: Internet
Author: User
Tags time limit

10213-how Many Pieces of land?

Time limit:3.000 seconds

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem= 1154

You are given a elliptical shaped land and your are asked to choose N arbitrary in its points. Then you connect all of these points with one another with straight lines (that's N. (n-1)/2 connections for n points). What is the maximum number of pieces for you'll get by choosing the points on the boundary carefully?

Fig:when the value of n is 6.

Input

The ' the ' input file contains one integer S (0 < s < 3500), which indicates how many sets of input are T Here. The next S lines contain ssets of input. Each input contains one integer N (0<=n<2^31).

Output

For each set of input, should output in a single line the maximum number pieces, possible to get for the value O F N.

Sample Input:

4

1

2

3

4

Sample Output:

1

2

4

8

A good question on the P86, I've worked out the formula O (1).

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.