An Angular Puzzle - UVa 12301 几何
来源:互联网 发布:c语言编程规则 编辑:程序博客网 时间:2024/06/04 17:49
An Angular Puzzle
Here is an old interesting puzzle: In the picture below, what is the angle of DEA, in degrees? Note that 5 angles are already given. The picture is drawn to scale.
You're to solve a generalized problem: let a, b, c, d, e be the angle of ACB, CAE, EAB, CBD, DBA (in degrees), what is the angle of DEA, in degrees?
Note that E must be strictly on segment BC (cannot coincide with B or C), and D must be strictly on segment AC (cannot coincide with A or C). The triangle ABC must be non-degenerated (i.e. ABC cannot be collinear). Not all combination of parameters a, b, c, d and e corresponds to a valid figure described above. Your program should be able to detect this.
Input
There will be at most 100 test cases. Each case contains 5 integers a, b, c, d, e (0 < a, b, c, d, e < 90). The last test case is followed by five zeros, which should not be processed.
Output
For each test case, print the answer to two decimal places. If there is more than one solution, print "Multiple solutions". If the input is incorrect (i.e. there is no valid picture for these parameters), print "Impossible" (without quotes).
Sample Input
20 10 70 20 6030 5 70 15 6060 30 30 30 3030 40 40 40 400 0 0 0 0
Output for the Sample Input
20.0012.9630.00Impossible
题意:求图中角x的大小。
思路:假设AB=1,那么可以求出AD,AE的长度,进而可以求出DE的长度,然后x的大小就可以求出。
AC代码如下:
#include<cstdio>#include<cstring>#include<cmath>using namespace std;int main(){ int a,b,c,d,e,f; double AB,AE,AD,p,DE,ans; while(~scanf("%d%d%d%d%d",&a,&b,&c,&d,&e) && a+b+c+d+e>0) { if(a+b+c+d+e!=180) { printf("Impossible\n"); continue; } AB=1; AE=AB*sin((d+e)*M_PI/180)/sin((180-c-d-e)*M_PI/180); AD=AB*sin(e*M_PI/180)/sin((180-b-c-e)*M_PI/180); DE=sqrt(AE*AE+AD*AD-2*AE*AD*cos(b*M_PI/180)); ans=acos((AE*AE+DE*DE-AD*AD)/(2*AE*DE))/M_PI*180; printf("%.2f\n",ans); }}
- An Angular Puzzle - UVa 12301 几何
- UVA 12301 - An Angular Puzzle(计算几何)
- uva 12301 - An Angular Puzzle(几何)
- UVA - 12301 - An Angular Puzzle (计算几何~平面三角)
- uva 12301 - An Angular Puzzle
- UVA - 12301-An Angular Puzzle
- UVa 12301 An Angular Puzzle 平面角度计算
- Puzzle UVA
- Puzzle UVA
- 计算几何专项:UVa 12301
- UVA 421 Polygonal Puzzle
- uva 519 Puzzle (II)
- UVA - 519 Puzzle (II)
- UVa 227 - Puzzle
- UVa 227 - Puzzle
- Uva-227-Puzzle
- UVa 227 Puzzle
- UVA - 227 Puzzle
- 调试Oracle 之一 基础篇
- servlet的生命周期
- 守护进程及守护进程输出
- MongoDB新的数据统计框架介绍
- 数据结构专题——堆
- An Angular Puzzle - UVa 12301 几何
- Hive hwi 0.14.0 图形界面安装与配置
- linux l2tp ipsec vpn服务器
- FSO出现输入超出了文件尾的解决办法[ASP]
- CCS+C6678LE开发记录10:(图像)数据处理与传输框架
- 如何控制应用程序使用的内存
- Utilize Action Mechanism in Web Test Automation to Save the Effort for Frequent Code Change
- 在vs中使用libcurl静态库
- UNIX环境C语言编程(11)-高级IO