WOJ1034-Cut the Apple

xiaoxiao2021-02-28  87

On the way home, DragonFly has got an extraordinarily large apple. He would like to share it with his friends. Now he wants to get as many pieces as possible with n cuts. But he cannot decide how to cut it, because the apple is rather delicious. Now he needs your help.

输入格式

Each line contains an integer n (0<= n <= 100000). Input will be terminated by EOF.

输出格式

You should print the largest number of pieces by n cuts of each case .

样例输入

1 2 3

样例输出

2 4 8

N个平面可以把空间分成(n*n*n+5*n+6)/6份

#include<stdio.h> #include<math.h> int main() { long long n; long long max; while(scanf("%lld",&n)!=EOF) { max=(n*n*n+5*n+6)/6; printf("%lld\n",max); } return 0; }

转载请注明原文地址: https://www.6miu.com/read-28518.html

最新回复(0)