c语言sscanf函数的用法是什么
252
2022-12-02
NYOJ--319-Splitting plane
Splitting plane
1000 ms | 内存限制: 65535
2
We have seen many problems about straight line splitting plane.Today ours problem has little difference with before.Because this time we don't use a straight line to splitting plane,we use a broken line to splitting plane.
For example , a broken line can divided a plane to two parts, two broken line can divided a plane to seven parts.
The first line input an integer N(1 Then N trip test data Each test data have a integer M. M represents the number of broken lines.(0 输出
For each test case, please output plane's biggest segmentation number, the output of each instance of one line.
样例输入 21
2 样例输出 27 来源 HDOJ 推规律题: 分割平面的个数=交点个数+顶点个数+1。 令f(n-1)为前n-1条折线分割的平面数,当添加第n条折线时。 因为每一条边与前n-1条折线的两条边都相交,故增加的交点数为2*2*(n-1),顶点增加1,故 f(n)=f(n-1)+4(n-1)+1,再累加。 参考代码; /************NYOJ319Result:AcceptedTimes:164ms;Author:jiabeimuwei*************/#include 公式套用: #include
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~