第四届吉林省大学生程序设计大赛个人解题报告 Problem B: The Farmer’s Heritage
来源:互联网 发布:做淘宝客服有什么前途 编辑:程序博客网 时间:2024/04/29 15:51
Problem B: The Farmer’s Heritage
A farmer who had worked hard all his life on his triangular farm was taken sick. He knew that he must soon die. He called his three sons about his bed to give them some advice. "My sons," said he, "keep all of the land which I leave you. Do not sell any of it, for there is a treasure in the soil. I shall not tell you where to hunt for it, but if you try hard to find it, and do not give up, you will surely succeed. As soon as the harvest is over, begin your search with plow, and spade, and rake. Turn every foot of earth, and then turn it again and again. The treasure is there." After the father died, the sons gathered in the harvest. As soon as the grain had been cared for, they planned to search for the hidden treasure. The farm was divided into three small triangles. Each son agreed to dig carefully his part. Every foot of soil was turned by the plow or by the spade. It was next harrowed and raked, but no treasure was found. That seemed very strange. "Father was an honest man and a wise man," said the youngest son. "He would never have told us to hunt for the treasure if it were not here. Do you not remember that he said, 'Turn the soil again and again'? He surely thought the treasure worth hunting for." "Our land is in such good condition now that we might as well sow winter wheat," said the oldest son. His brothers agreed to this and the wheat was sown. The next harvest was so great that it surprised them. No neighbor's field bore so many bushels of wheat to the acre. The sons were pleased with their success. This story tells us that we must work hard to success. And do you know how these three sons divide the farm? Because of their ages, three sons acquired different are of this heritage. The eldest brother should get 1/2, the second should get 1/3, and the youngest son get 1/6.
Input
There are x and y coordinates of three triangle vertices in one line. These six
numbers are all real number. The edge against the first vertex belongs to the eldest brother, the edge against the third vertex belongs to the youngest, and so the second. For each case, you should find a point inside the triangle that can divide the original triangle to three equal triangles.
Output
Output the x and y coordinates of the expected point in one line separate by a
space. Keep 3 digits after the decimal point.
Sample Input
0.0 0.0 0.0 6.0 6.0 0.0
Sample Output
1.000 2.000
这道题算得上一道计算几何题,题目大概意思是:给你三个顶点的笛卡尔坐标,你的任务是在三角形内找到一点P,使得P与三个顶点的连线所分割的三角形面积比例为1/2 : 1/3 : 1/6,输出这个P点的坐标。
这题很多人貌似一看就想到设P点坐标为(x0,y0),然后用海伦公式求出三个面的面积,然后列方程解出P点。但是这个思路不容易实现为算法,所以,需要找到一个更好的方法。
可以看出,若做出三角形三边的中位线,三等分线,六等分线,将交于一点,该点即为所求的P点。具体实现的时候可以用向量的运算求P点,可以简化很多运算。
- 第四届吉林省大学生程序设计大赛个人解题报告 Problem B: The Farmer’s Heritage
- 第四届吉林省大学生程序设计大赛个人解题报告 Problem C: The Natural Series
- 第四届吉林省大学生程序设计大赛个人解题报告 Problem A: Harshad Number
- 第四届吉林省大学生程序设计大赛个人解题报告 Problem F: Coin Game
- 第四届吉林省大学生程序设计大赛个人解题报告 Problem J: Buying and Selling
- 第四届吉林省大学生程序设计大赛个人解题报告 Problem H: New Feature in Windows 7
- 4th Jilin Province Collegiate Programming Contest-Problem B: The Farmer’s Heritage
- 河南省第一届大学生程序设计大赛解题报告
- 河南省第一届大学生程序设计大赛解题报告
- 第八届湖南省大学生程序设计大赛 - 笑不语@USC 随笔,感想,解题报告
- 第八届湖南省大学生程序设计大赛 - 笑不语@USC 随笔,感想,解题报告
- 第四届福建省ACM程序设计大赛解题报告(未完待续)
- 华中农业大学第四届程序设计大赛网络同步赛解题报告
- 山东省第四届ACM程序设计大赛 Problem A:Rescue The Princess (计算几何)
- ECNU第四届程序设计竞赛解题报告
- Farmer Bill's Problem
- 珠海邀请赛个人解题报告 Problem B: Magic Matrix
- 5/30 第三届吉林省大学生程序设计竞赛
- 珠海邀请赛个人解题报告 Problem E: Cinema
- KMP算法笔记
- http 异常说明
- "/Symbian/9.2/S60_3rd_FP1/EPOC32/" does not exist
- Emacs bookmark 命令
- 第四届吉林省大学生程序设计大赛个人解题报告 Problem B: The Farmer’s Heritage
- 我来了
- 第四届吉林省大学生程序设计大赛个人解题报告 Problem A: Harshad Number
- 91助手方便将iphone手机中的照片和录像导出到电脑中
- Turbo C的图形系统
- linux 系统函数学习
- 世界上最健康的作息时间表
- 第四届吉林省大学生程序设计大赛个人解题报告 Problem F: Coin Game
- 第四届吉林省大学生程序设计大赛个人解题报告 Problem J: Buying and Selling