UVa 10286 - Trouble with a Pentagon
来源:互联网 发布:sqlserver导入sql文件 编辑:程序博客网 时间:2024/06/05 15:36
题目:如图在正五边形中画一个正方形,一直正五边形边长,求正方形边长。
分析:计算几何,解析几何。求出边长的比例关系带入求解即可。
设正五边形边长为1,在顶点建立直角坐标系,则左上角坐标为:B(-cos36,-sin36);
再计算出左下角坐标:C(-2cos36cos72,-cos36sin72);
求直线BC与直线y = x(正方形边所在直线)的交点,即为正方形左边顶点坐标(X,Y);
长度即为sqrt(2.0)* fabs(X)。
说明:别忘了乘sqrt(2.0)。
#include <iostream>#include <cstdlib>#include <cstdio>#include <cmath>using namespace std;int main(){double A = acos(-1.0)/2.5,B = acos(-1.0)/5.0;double p = 2.0*sin(B)*cos(B)*cos(A)-2.0*cos(B)*cos(B)*sin(A);double q = sin(B)-cos(B)+2.0*cos(B)*cos(A)-2.0*cos(B)*sin(A);double n;while (~scanf("%lf",&n))printf("%.10lf\n",n*sqrt(2.0)*p/q);return 0;}
0 0
- UVa 10286 - Trouble with a Pentagon
- UVA, 10286 Trouble with a Pentagon
- uva 10286 Trouble with a Pentagon
- uva_10286_Trouble with a Pentagon
- Having trouble with a BeagleBoard GPIO interrupt pin
- The Trouble With Multicore
- The Trouble With Girls
- "The Trouble with Checked Exceptions A Conversation with Anders Hejlsberg, Part II" 阅读笔记
- Trouble is a friend
- Trouble is a friend
- trouble is a friend
- The Trouble with Checked Exceptions
- UVA 10217: A Dinner with Schwarzenegger!!!
- UVA 10217 A Dinner with Schwarzenegger!!!
- Trouble shooting:login failed for user 'sa' ,the user is not associated with a trusted SQL Server
- Trouble with expressions in Jasper Reports
- The Trouble With Multicore-David Patterson
- Java - Get Started with Trouble Shooting
- Android 修改光标颜色
- input device
- The Little Book on CoffeeScript - 语法
- weblogic 创建域
- HDU 2544 用优先队列写的最短路径
- UVa 10286 - Trouble with a Pentagon
- 第七周项目一电阻串联
- Spring实现AOP的4种方式
- 【代码实现】使用PHP导入和导出CSV文件
- Ucosii消息邮箱使用
- 第7周项目1电阻串联
- MZ Training 2014 #6 A题
- Spring注解@Component、@Repository、@Service、@Controller区别
- JdbcDaoSupport 操作CLOB、BLOB数据字段