UVA10213 How Many Pieces of Land数学+大数

Posted 海岛Blog

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了UVA10213 How Many Pieces of Land数学+大数相关的知识,希望对你有一定的参考价值。

You are given an elliptical shaped land and you are asked to choose n arbitrary points on its boundary. Then you connect all 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 of land you will get by choosing the points on the boundary carefully?
在这里插入图片描述
Fig: When the value of n is 6

Input
The first line of the input file contains one integer S (0 < S < 3500), which indicates how many sets of input are there. The next S lines contain S sets of input. Each input contains one integer N (0 ≤ N < 231).
Output
For each set of input you should output in a single line the maximum number pieces of land possible to get for the value of N.
Sample Input
4
1
2
3
4
Sample Output
1
2
4
8

问题链接UVA10213 How Many Pieces of Land
问题简述:一个椭圆形的平面,在边界上有n个点,连接这些点构成内接多边形,问最多把平面分成几块?
问题分析:大数计算问题,用Python来解决,不解释。
程序说明:(略)
参考链接:(略)
题记:(略)

AC的Python语言程序如下:

# UVA10213 How Many Pieces of Land

t = int(input())
for i in range(t):
	n = int(input())
	print(n * (n ** 3 - 6 * n ** 2 + 23 * n - 18) // 24 + 1)

以上是关于UVA10213 How Many Pieces of Land数学+大数的主要内容,如果未能解决你的问题,请参考以下文章

UVA - 10213 How Many Pieces of Land?(欧拉公式 + 高精度)

UVa 10213 How Many Pieces of Land ? (计算几何+大数)

划分土地(how many pieces of land)

UVA - 10061 How many zero&#39;s and how many digits ?

How Many O's? UVA - 11038

UVA12296 Pieces and Discs