1471: Wall时间限制(普通/Java):1000MS/10000MS 内存限制:65536KByte总提交: 162 测试通过:98 描述 Once upon a time there was a greedy King who ordered his chief Architect to build a wall around the King's castle. The King was so greedy, that he would not listen to his Architect's proposals to build a beautiful brick wall with a perfect shape and nice tall towers. Instead, he ordered to build the wall around the whole castle using the least amount of stone and labor, but demanded that the wall should not come closer to the castle than a certain distance. If the King finds that the Architect has used more resources to build the wall than it was absolutely necessary to satisfy those requirements, then the Architect will loose his head. Moreover, he demanded Architect to introduce at once a plan of the wall listing the exact amount of resources that are needed to build the wall.
输入 The first line of the input file contains two integer numbers N and L separated by a space. N (3 <= N <= 1000) is the number of vertices in the King's castle, and L (1 <= L <= 1000) is the minimal number of feet that King allows for the wall to come close to the castle. 输出 Write to the output file the single number that represents the minimal possible length of the wall in feet that could be built around the castle to satisfy King's requirements. You must present the integer number of feet to the King, because the floating numbers are not invented yet. However, you must round the result in such a way, that it is accurate to 8 inches (1 foot is equal to 12 inches), since the King will not tolerate larger error in the estimates. 样例输入 样例输出 提示 结果四舍五入就可以了 不知道为什么出c++17过不了,但是c++可以过,还没找到原因 参考了二维凸包公式模版 用叉乘和周长做,在转交处,弧形最短,所以加上L为半径的圆的长度 //ans=凸包周长+半径为 L 的圆的周长
AC代码 #include<bits/stdc++.h> |
TZOJ1471: Wall
最新推荐文章于 2024-06-12 10:00:23 发布