Hướng dẫn giải của Bedao Grand Contest 08 - GEOMETRY
Chỉ dùng lời giải này khi không có ý tưởng, và đừng copy-paste code từ lời giải này. Hãy tôn trọng người ra đề và người viết lời giải.
Nộp một lời giải chính thức trước khi tự giải là một hành động có thể bị ban.
Nộp một lời giải chính thức trước khi tự giải là một hành động có thể bị ban.
Code mẫu
#include <bits/stdc++.h> #define ld long double using namespace std; ld pi=3.1415926535897932384626433; int test; ld r1,r2,al,x,rr,beta,beta1,haf,s,res; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); freopen("GEOMETRY.INP","r",stdin); freopen("GEOMETRY.OUT","w",stdout); cin>>test; while(test--){ cin>>r1>>r2; al=atan((r1+r2)/r1); x=2.0000*r1*cos(al); rr=r1*r1; beta=acos((2.000*rr-x*x)/(2.000*rr)); beta1=pi/2.000-beta; haf=(r1+r1+x)/2.000; s=sqrt(haf*(haf-r1)*(haf-r1)*(haf-x)); res=r1*(r1+r2)-s-beta1*rr-(pi/2.000-al)*r2*r2; res=res/2.000; cout<<setprecision(4)<<fixed<<res<<'\n'; } }
Bình luận