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 |
Re:你这种做法的精度不是特别高,你试试第三组数据,它的结果是7.67,和答案不一样In Reply To:更简单的程序, 呵呵 Posted by:ericsummer at 2005-08-05 18:50:29 > #include <iostream.h> > #include <math.h> > #include <iomanip.h> > > > double min(double x ,double y) > { > return x<y?x : y ; > } > > int main() > { > > double r , h , d1 , a1 , d2 , a2 ,x ,d; > > double pi = 2.0* asin(1); > > while(cin >> r >> h >> d1 >> a1 >> d2 >> a2) > { > > x = r*fabs(a1 - a2)/sqrt( r*r + h*h) * pi/180.0; > > x = min(x , 2*pi*r/sqrt( r*r + h*h) -x); > > d = sqrt( d1*d1+ d2*d2 - 2*d1*d2*cos(x)); > > > > > cout<< fixed << setpricision(2) << endl; > > } > > return 0; > > > } 但是提交可以通过,这说明他的测试数据不是特别精确 Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator