Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
我帮你把代码整成C++的就过了,顺便帮你修改了一个bug,你忘记处理H了In Reply To:这么简单的问题也错,高人帮看看吧 Posted by:faen at 2005-05-12 19:06:31 #include <iostream> #include <cmath> using namespace std; int main() { //freopen("1.txt", "r", stdin); double D,H,a,b,y; cin>>D>>H; while (cin>>a>>b>>y, a+b+y > 0) { a = a/180*3.1415926; b = b/180*3.1415926; y = y/180*3.1415926; double tanb2 = tan(b)*tan(b); double h = sqrt(2*D*D*tanb2/(1/tan(y)*tanb2*1/tan(y) + 1/tan(a)*tanb2*1/tan(a)-2)); printf("%.0lf\n", H+h); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator