#include<iostream> #include<iomanip> #include<math.h> #include<string> #include<vector> #include<queue> #include<map> #include<set> #include <stdio.h> #define PI 3.14159265 using namespace std; double leg(int a,int a1,int b,int b1) { a=abs(ab); b=abs(a1-b1); return sqrt(a*a+b*b); } int main() { int a,a1,b,b1,d,d1; double f,s,f1,s1,m,x,y,z,r,k,p; float u; cin>>a>>a1>>b>>b1>>d>>d1>>r; u=r; f=leg(a,a1,d,d1); s=leg(b,b1,d,d1); m=leg(b,b1,a,a1); f1=sqrt(f*fr*r); s1=sqrt(s*sr*r); x=acos(r/f)*180.0/PI; y=acos(r/s)*180.0/PI; z=acos((m*m-(f*f+s*s))/(-1*(2*f*s)))*180.0/PI; z=z-(x+y); z=(2*PI*r*z)/360; p=(f+s+m)/2; k=(2*sqrt(p*(pf)*(ps)*(pm)))/m; float q; q=k; if(u>q) cout<<fixed<<setprecision(3)<<f1+s1+z<<endl; else cout<<m<<endl; system("pause"); return 0; } 

Closed due to the fact that off-topic participants Kromster , Harry , αλεχολυτ , aleksandr barakin , D-side 29 Oct '16 at 15:04 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • “Questions asking for help with debugging (“ why does this code not work? ”) Should include the desired behavior, a specific problem or error, and a minimum code for playing it right in the question . Questions without an explicit description of the problem are useless for other visitors. See How to create minimal, self-sufficient and reproducible example . " - Kromster, αλεχολυτ, aleksandr barakin, D-side
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • Making the code at a height - user31238
  • four
    Describe the task, describe the problem, and format the code. - Roman
  • 2
    As I understand it, the task you think is so well known that anyone should know it? ... - Harry
  • @Harry any ... ant. Or a tree :) - αλεχολυτ
  • @alexolut Any oak tree :) By the way, the translation in radians to degrees and back touches :) - Harry

1 answer 1

Okay, Saturday, I'm relaxing ... :)

 inline double dist2(double x, double y){ return x*x+y*y; } inline double dist(double x, double y) { return sqrt(dist2(x,y)); } int main(int argc, const char * argv[]) { double x1, y1, x2, y2, x, y, r; cin >> x1 >> y1 >> x2 >> y2 >> x >> y >> r; x1 -= x; y1 -= y; x2 -= x; y2 -= y; x = acos(r/dist(x1,y1)) + acos(r/dist(x2,y2)); y = acos((x1*x2+y1*y2)/(dist(x1,y1)*dist(x2,y2))) - x; if (y < 0) y = dist(x1-x2,y1-y2); else y = sqrt(dist2(x1,y1)-r*r) + sqrt(dist2(x2,y2)-r*r) + y*r; cout << y << endl; } 

Just keep in mind that this solution has already taken 1st place on www.e-olymp.com, so it’s just a bit of a mess to you :)