Test Instructions:Link
Method:Mountain Climbing algorithm
parsing:First select a point, and then find the direction of its external forces, in this direction to go. Repeat until the temperature is less than EPS. As for why, because the direction of each walk must be, so can be regarded as a single peak function? You do not need to anneal directly to climb.
Code:
#include <cmath>#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>#define N 10010#define EPS 1e-8#define PRO 0.97using namespace STD;intNstructpoint{Doublex, y;friendostream&operator<< (Ostream &_,point a) {printf("%.3lf%.3lf\n", A.X,A.Y);return_; } point () {}, point (Double_x,Double_y): X (_x), Y (_y) {} pointoperator+ (ConstPoint &a) {returnPoint (X+A.X,Y+A.Y);} Pointoperator- (ConstPoint &a) {returnPoint (X-A.X,Y-A.Y);} Pointoperator* (DoubleRate) {returnPoint (X*rate,y*rate);}Double operator* (ConstPoint &a) {returnX*A.X+Y*A.Y;}};structgty{point P;DoubleGfriendistream&operator>> (IStream &_,gty &a) {scanf("%LF%LF%LF", &A.P.X,&A.P.Y,&A.G);return_; }}pt[n];DoubleGet_dis (Point A,point b) {return sqrt(A-B) * (a)); }point get_direction (Point a) {point P (0,0); for(intI=1; i<=n;i++) {point tmp= (pt[i].p-a) * (Pt[i].g/get_dis (pt[i].p,a)); p=p+tmp; }returnP;} Point Climb_hill,DoubleBasement) {if(basement<eps)returnNow Point To=get_direction (now); To=to*basement;returnClimb_hill (Now+to,basement*pro);}intMain () {scanf("%d", &n); for(intI=1; i<=n;i++)Cin>>pt[i]; Point Base_point (1999.5,329.5); Point Ans=climb_hill (Base_point,100000);cout<<ans;}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Bzoj 3680 amputated xxx mountain climbing algorithm