SHARE
TWEET

oks 66 I (17)

mrfeedoz Apr 24th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<iostream>
  2. #include<math.h>
  3. using namespace std;
  4. struct point
  5. {
  6.  int x, y, z;
  7. };
  8.  
  9. double dlina(point a, point b)
  10. {
  11.  return sqrt(pow(a.x-b.x, 2)+ pow(a.y-b.y, 2)+pow(a.z-b.z,2));
  12. }
  13.  
  14. int main()
  15. {
  16.  double s=0, o=0;
  17.  int n;
  18.  point a[10], p1, p2,p3;
  19.  cin>>n;
  20.  for(int i=0;i<n;++i)
  21.  {
  22.   cin>>a[i].x>>a[i].y>>a[i].z;
  23.  }
  24.  for(int i=0;i<n-2;++i)
  25.  {
  26.   for(int j=i+1;j<n-1;++j)
  27.   {
  28.    for(int k=j+1;k<n;++k)
  29.    {
  30.           o=dlina(a[i],a[j])+dlina(a[j],a[k])+dlina(a[k],a[i]);
  31.     if(o>s)
  32.     {
  33.      s=o;
  34.      p1=a[i];
  35.      p2=a[j];
  36.      p3=a[k];
  37.     }
  38.    }
  39.   }
  40.  }
  41.  cout<<s<<endl;
  42.  cout<<p1.x<<' '<<p1.y<<' '<<p1.z<<endl;
  43.  cout<<p2.x<<' '<<p2.y<<' '<<p2.z<<endl;
  44.  cout<<p3.x<<' '<<p3.y<<' '<<p3.z<<endl;
  45.  cout<<endl;
  46.  system("pause");
  47.  return 0;
  48. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top