Home STD Contest Notification Clarification Problems Ranklist Status Print Sign Out
比赛题目已经加到题库最后,欢迎继续AC~More...

Triangle

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 640    Accepted Submission(s): 241


Problem Description
K likes to play with the balls.That day he piled a triangle (n layers, layer 1 start,the first layer has 1 ball,the secode layer has 2 balls,……,the nth layer has n balls), but he felt uncomfortable after completion, and want to pile a right triangle, because he felt that the number 4 is a lucky one (because of “si ji fa cai”). So he decided to use 4 times of the balls he just used as a right-edge side of the right triangle(the three edges have no common factor).He only to pile the three edges,that is the middle is empty.But there will not have so many balls,so he wants to know the minimum of balls he must use.Now ,he turn to you for help.
 

Input
The layer of the triangle as the promble describes n,1 <= n < 2^16
 

Output
The minimum of balls he must use and the length of the hypotenuse. One case one line
 

Sample Input
1 2 3
 

Sample Output
9 5 27 13 53 25 The second case: Let the right_edge promble describles is b ,The layer is 2,so b is 4 * (1 + 2) = 12.wo can know the edges of right triangle is 5 , 12 ,13. So the minimum of balls he must use is (5 + 12 + 13 – 3) = 27
 

Author
Klion@CSU
 

Statistic | Submit | Clarifications | Back