New Game time limit: 1 Sec memory limit: MB Special Judge
Submitted by: 157 Resolution: 53
Submitted State [Discussion Version] [Propositional person:Admin] Topic Description Eagle Jump is developing a new game. With 123 as its staff, we have the opportunity to play in advance. Now she is trying to pass a maze.
This maze has some features. To facilitate the description, we set up a planar Cartesian coordinate system for this maze. There are two parallel straight l1:ax+by+c1=0,l2:ax+by+c2=0 in the maze and n circles. Character in a straight line, round, round, walk without exertion of energy. In other locations, the S-point goes to the T-point to consume the physical strength of s and T's Euclidean distance.
123 want to start from L1, go to L2. Please calculate the minimum amount of physical energy required.
Enter the first line of five positive integer N,A,B,C1,C2 (1≤n≤1000,−10000≤a,b,c1,c2≤10000), where a, b differs by 0.
The next n rows of three integers per line x,y,r (−10000≤x,y≤10000,1≤r≤10000) represent a circle with a radius of R (x, y).
The output is only a single real number for the answer. The absolute error of the standard answer or the relative error of not more than 10-4 is counted correctly.
Sample input
2 0 1 0-40 1 11 3 1
Sample output
0.236068
Test Instructions
Give some circles and two parallel lines, in the circle, the circle and the line walk does not consume the physical strength, other consumes the physical strength is two points between the geometrical distance.
Analysis
It is very simple to see the shortest way, and it is possible to run the shortest way directly.
///Author:kissheart///#include <stdio.h>#include<algorithm>#include<iostream>#include<string.h>#include<vector>#include<stdlib.h>#include<math.h>#include<queue>#include<deque>#include<ctype.h>#include<map>#include<Set>#include<stack>#include<string>#defineINF 0x3f3f3f3f#defineFast_io Ios::sync_with_stdio (False)Const DoublePI = ACOs (-1.0);Const DoubleEPS = 1e-6;Const intmax=1e5+Ten;Const intmod=1e9+7; typedefLong Longll;using namespacestd;#defineGCD (A, B) __gcd (A, B)Inline ll LCM (ll A,ll b) {returnA/GCD (A, b) *b;} inline ll Qpow (ll A,ll b) {ll r=1, T=a; while(b) {if(b&1) r= (r*t)%mod;b>>=1; t= (t*t)%mod;}returnR;} inline ll Inv1 (ll b) {returnQpow (b,mod-2);} inline ll EXGCD (ll A,ll b,ll&x,ll &y) {if(!B) {x=1; y=0;returnA;} ll R=EXGCD (b,a%b,y,x); y-= (A/b) *x;returnR;} inline ll read () {ll x=0, f=1;CharC=getchar (); for(;! IsDigit (c); C=getchar ())if(c=='-') f=-1; for(; IsDigit (c); C=getchar ()) x=x*Ten+c-'0';returnx*F;}//freopen ("In.txt", "R", stdin);//freopen ("Data.txt", "w", stdout);ll P1,p2;ll q1,q2;ll a,b,c;intMain () {intflag=0; scanf ("%lld%lld%lld",&a,&b,&c); scanf ("%lld%lld%lld%lld",&p1,&p2,&q1,&Q2); ll ans=1e18,x,y; for(LL i=-1e5;i<=max;i++) { if((c-a*i)%b==0) {x=i; Y= (c-a*i)/b; Flag=1; Ans=min (ans,p2*x*x+p1*x+q2*y*y+q1*y); } } if(flag) printf ("%lld\n", ans); Elseprintf"kuon\n"); return 0;}
View Code
UPC 9519 New Game