当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3422:Triangle

题目描述
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.
输入解释
The layer of the triangle as the promble describes n,1 <= n < 2^16
输出解释
The minimum of balls he must use and the length of the hypotenuse. One case one line
输入样例
1
2
3
输出样例
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
来自杭电HDUOJ的附加信息
Author Klion@CSU
Recommend lcy

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-3422

最后修改于 2020-10-25T23:03:23+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 32768/32768K(Java/Others)