POJ 2069 Super Star Mountain climbing

Source: Internet
Author: User

Main topic

Space Minimum Ball cover

Ideas

Do some water problem qwq before rolling rough

CODE
#define _crt_secure_no_warnings#include <cmath>#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>#define INF 1e15#define EPS 1e-7#define MAXusing namespace STD;structpointiii{DoubleX, y, Z; POINTIII (Const Double&_,Const Double&AMP;__,Const Double&___): X (_), Y (__), Z (___) {} pointiii () {} POINTIIIoperator+(ConstPOINTIII &a)Const{returnPOINTIII (x + a.x, y + a.y, z + a.z); } POINTIIIoperator*(Const Double&a)Const{returnPOINTIII (x * A, Y * A, Z * a); }voidRead () {scanf("%LF%LF%LF", &x, &y, &z); }}point[max];intPointsDoubleans, fin;inline unsigned intRand () {returnRAND () * RAND ();inline DoubleCalc (ConstPOINTIII &p1,ConstPOINTIII &p2) {return sqrt((p1.x-p2.x) * (p1.x-p2.x) + (P1.Y-P2.Y) * (P1.Y-P2.Y) + (p1.z-p2.z) * (P1.Z-P2.Z));}voidSA () {DoubleT =100.0;Doublex =0, y =0, z =0; for(inti =1; I <= points;    ++i) x + = point[i].x, y + = Point[i].y, z + = point[i].z;    POINTIII Now (x/points, y/points, z/points); Ans =inf; while(T > EPS) {intp =1; for(inti =2; I <= points; ++i)if(Calc (now, point[i]) > Calc (now, point[p]) p = i;DoubleR = Calc (now, point[p]);        ans = min (ans, R);        now.x + = (point[p].x-now.x)/R * T;        Now.y + = (POINT[P].Y-NOW.Y)/R * T;        Now.z + = (point[p].z-now.z)/R * T; T *=. 98; }}intMain () { while(scanf("%d", &points), points) { for(inti =1; I <= points; ++i) Point[i].        Read (); SA ();printf("%.5f\n", ans); }return 0;}

POJ 2069 Super Star Mountain climbing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.