uva 12301 - An Angular Puzzle
来源:互联网 发布:杭州初级程序员薪资 编辑:程序博客网 时间:2024/05/23 00:56
题意:如图,已知角ACB,角CAE, 角EAB, 角CBD, 角DBA (in degrees), 求角 DEA。
注意:在 Output 中,“If there is more than one solution, print "Multiple solutions"”这句话是迷惑你的,根本没有这种情况!
#include<iostream>#include<iomanip>#include<cmath>#define pi (2.0*asin(1.0))using namespace std;typedef struct point{ double x,y; point(double xx=0,double yy=0):x(xx),y(yy){}}vector;vector operator - (point a,point b){ return vector(a.x-b.x,a.y-b.y);}point operator + (point a,vector b){ return point(a.x+b.x,a.y+b.y);}vector operator * (vector a,double b){ return vector(a.x*b,a.y*b);}double dot(vector a,vector b){ return a.x*b.x+a.y*b.y;}double len(vector a){ return sqrt(dot(a,a));}double angle(vector a,vector b){ return acos(dot(a,b)/len(a)/len(b));}double cross(vector a,vector b){ return a.x*b.y-a.y*b.x;}vector rot(vector a,double rad){ double c=cos(rad),s=sin(rad); return vector(a.x*c-a.y*s,a.x*s+a.y*c);}point inter(point p,vector v,point q,vector w){ vector u=p-q; double t=cross(w,u)/cross(v,w); return p+v*t;}int main(){ double a,b,c,d,e,s; point pa,pb,pd,pe; pb.x=10; while(cin>>a>>b>>c>>d>>e) { s=a+b+c+d+e; if(s==0) break; else if(s!=180) cout<<"Impossible"<<endl; else { b*=pi/180; c*=pi/180; d*=pi/180; e*=pi/180; vector v=rot(pb-pa,b+c),w=rot(pb-pa,pi-d-e); pd=inter(pa,v,pb,rot(pb-pa,pi-e)); pe=inter(pa,rot(pb-pa,c),pb,w); double x=angle(pe-pd,pe-pa)*180/pi; cout<<fixed<<setprecision(2)<<x<<endl; } } return 0;}
- uva 12301 - An Angular Puzzle
- UVA - 12301-An Angular Puzzle
- 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 (计算几何~平面三角)
- Puzzle UVA
- Puzzle UVA
- 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
- Uva-227 - Puzzle-AC
- MFC下测量程序执行时间
- 解决:Google代码achartengine曲线代码报错问题
- HDU 3609Up-up(层层递推降幂+蛋疼的特判)
- hdu 1074 Doing Homework(状态压缩DP)
- AChartEngine小Demo,肯定能运行的。
- uva 12301 - An Angular Puzzle
- 我的Android进阶之旅------>Android基于HTTP协议的多线程断点下载器的实现
- 留给自己
- 1一站式C语法深究
- JFreeChart使用
- 为什么游戏叫第九艺术?
- 编程之美3.1字符串移位包含问题
- 工作中的随感
- Ubuntu更新管理器下载程序