Bzoj 3680 amputated xxx mountain climbing algorithm

Source: Internet
Author: User

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", &AMP;A.P.X,&AMP;A.P.Y,&AMP;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

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.