|
|
вернуться в форумHelp me My program dont work on sample test. #include <iostream> #include <cmath> using namespace std; #define x1 x11 #define y1 y11 #define z1 z11 int x1,x2,x3,y1,y2,y3,z1,z2,z3,r,v1x,v1y,v2x,v2y,v1z,v2z; long double l,d1,d2,a,t1,t2,b,b1,b2; const long double pi = 3.1415926535897932384626433832795; int main() { cout.setf(ios::fixed | ios::showpoint); cout.precision(2); cin >> x1 >> y1 >> z1 >> x2 >> y2 >> z2 >> x3 >> y3 >> z3 >> r; d1 = sqrt((double)(x3-x1)*(x3-x1)+(y3-y1)*(y3-y1)+(z3-z1)*(z3-z1)); d2 = sqrt((double)(x3-x2)*(x3-x2)+(y3-y2)*(y3-y2)+(z3-z2)*(z3-z2)); l = sqrt((double)-r*r+d1*d1)+sqrt((double)-r*r+d2*d2); v1x = x1-x3; v1y = y1-y3; v1z = z1-z3; v2x = x2-x3; v2y = y2-y3; v2z = z2-z3; t1 = sqrt((double)v1x*v1x+v1y*v1y+v1z*v1z); t2 = sqrt((double)v2x*v2x+v2y*v2y+v2z*v2z); a = acos((double)(v1x*v2x+v1y*v2y+v1z*v2z)/(t1*t2)); if ((a/pi)*360.0>180.0) a = pi-a; b1 = acos((double)r/d1); b2 = acos((double)r/d2); a = a-b1-b2; cout << (a/pi)*360.0 << endl; l = l+(double)(2.0*r*a); cout << l; return 0; } |
|
|