2 shunfurh shunfurh 于 2017.01.02 16:49 提问

Baking the Shaobing

After LMY has been married to YY, YY lives in happiness, for LMY does all housework. When YY feels hungry, LMY cooks something for him to eat. When YY felt thirsty, LMY feeds him with water.

Now YY feels hungry again, so he asks LMY for food. But LMY is not at home. Fortunately, YY finds a piece of shaobing (a Chinese styled cake) in the kitchen.

This shaobing looks rather tempting. It has a shape of a simple polygon with N vertices, and its mess is evenly distributed. LMY had hung a string from the ceiling to the gravity center of the shaobing, so that the whole shaobing keeps balanced and lies in a horizontal plane although there is only one point hanging.

When YY starts to enjoy the shaobing, tragedy occurred… It is raw!

There is only one stove in the kitchen. Its cooking area lies in a horizontal plane and has a shape of a circle. YY has adjusted it to the same plane where the shaobing lies to cook it. The circle is centered at (x0, y0), with radius r. After turning on the stove, the part of the shaobing lying on the cooking area will be cooked.

However, the stove cannot be moved. So is the hanging point of the shaobing, or it may fall to the ground. The string can be moved, but YY cannot move it, because LMY has some special use with it. After all, YY can only rotate the shaobing by the hanging point.

YY is so hungry that he cannot wait for the whole shaobing to be cooked. He wants to rotate it to a best angle, cook it and then eat the cooked part, to comfort his stomach in a fastest way.

What angle should the shaobing be rotated to, so that the cooked part is the biggest?

输入:

The input contains several test cases. For each test case:

The first line consists of three integers x0, y0 and r, indicating the position and radius of the stove’s cooking area.

The second line contains an integer N (3<=N<=15), indicating the number of vertices of the shaobing.

In the third line there are N pairs of integers (x1, y1), (x2, y2), …, (xN, yN), indicating the coordinates of the vertices of the shaobing, in counterclockwise order.

All coordinates are in the range -1000 to 1000, inclusively.

There is a blank line separating test cases.

Input ends with a line where x0=y0=r=0, and this line should not be processed.

输出:

The input contains several test cases. For each test case:

The first line consists of three integers x0, y0 and r, indicating the position and radius of the stove’s cooking area.

The second line contains an integer N (3<=N<=15), indicating the number of vertices of the shaobing.

In the third line there are N pairs of integers (x1, y1), (x2, y2), …, (xN, yN), indicating the coordinates of the vertices of the shaobing, in counterclockwise order.

All coordinates are in the range -1000 to 1000, inclusively.

There is a blank line separating test cases.

Input ends with a line where x0=y0=r=0, and this line should not be processed.

样例输入:

0 0 1
3
0 0 1 0 0 1

0 0 0
样例输出:

0.5000

1个回答

caozhy
caozhy   Ds   Rxr 2017.01.06 22:43
已采纳
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!
其他相关推荐
Unity3D教程宝典之光影烘焙/Light baking
原创文章如需转载请注明:转载自风宇冲Unity3D教程学院                                    引言: 光影烘焙,英文叫Lightmapping 或 light baking。Unity自带了Lightmapping的功能(是Illuminate Labs出的名为Beast的产品)。 本系列教程分为4讲: 第一讲 光影烘焙 第二讲 AreaLight
HOJ——Baking Cakes 学习DP4
Baking Cakes Tom's birthday is coming up, and you have been put in charge of baking cakes for his monstrous birthdayparty. However, you have a great number of cakes to make, and a very short amou
Unity灯光烘焙设置详解
游戏场景中灯光照明的构成现实生活中的光线是有反射、折射、衍射等特性的。对这些基本特性的模拟一直以来都是计算机图形图像学的重要研究方向。在CG中,默认的照明方式都是不考虑这些光线特性的,因此出来的效果与现实生活区别很大。最早期的时候,人们利用各种方式来模拟真实光照的效果,比如手动在贴图上画上柔和阴影,或者用一盏微弱的面积光源去照明物体的暗部以模拟漫反射现象等等。然后出现了所谓的高级渲染器,用计算机的...
最近的Baking2
  说好的大场景,先这么大吧.找到足够的资源后可以摆出来.不过编辑器还是需要再进一步搞一下,才方便再做大.忙活了好几天,资源编辑方便搞出来了,很累人.  接下来,就解决接缝的问题了.貌似是最后一个技术问题了.周一还是比较累啊,是不是星期天的晚上不该装逼喝茶水啊.吼吼....
Unity 5.1 重大发布,新功能全力支持VR开发!
unity 5.1在今天发布了,我们在5.0发布之后并没有松懈太久便立即投入5.1的更新,想要了解5.1全部的更新请访问官方Release Notes, 以下就由小编来描述一下有哪些重大改变:   新功能:   Unity 5.1加入了新的网络功能,你可以从官方文件或是UnityEngine.Networking命名空间来查询更多的细节,通过这个API开发者能从较低阶的传输层传输数据,
最近的Baking3
 最近在处理接缝.如上图所示,效果很好.参照顽皮狗一篇文章点击打开链接和这篇大神的blog点击打开链接.想法非常  straightforwad,直接&quot;缝&quot;接缝边.也让我不禁感叹写代码不能靠瞎蒙,要一点一点都想好了,再写.写不出来,就说明还没有明白.放到项目里之后还有问题,正在解决.解决完处理接缝之后,回过头还要考虑是不是重写一下,或者换一个生成UV的库,目前这个库还是比较细碎,避免接缝效果和离线...
Unity光照贴图
Unity光照贴图
VertexDirt - AO baking tool 1.59.6.unitypackage
VertexDirt - AO baking tool 1.59.6.unitypackage
Vertex Baking
顶点颜色渲染是一种较早的渲染方法,它为模型的三维网格中的每个顶点提供一组单独的颜色值,然后在传入硬件进行光栅化渲染时GPU会根据顶点的颜色对每个像素进行相应的插值而得到Pixel上的颜色值,进而为多边形着上渐变色。由其操作模式可知,一个三角形内部的像素受到其关联的三个顶点上的颜色值所影响而不论三角形的大小,因而若三角形的密度较大时这种方法还是很不错的,但是,当整个网格中三角形的密度较小时(大面种区
Unity5 烘焙教程
https://www.sassybot.com/blog/lightmapping-in-unity-5/ In Unity3D, scenes can benefit greatly from atmospheric lighting and the shadows these lights cast. Nowadays most of this can be done realti