20000
Problem: Water problems, the game on the team to write this question, WA to the end, I did not see, down a bit on the
Code:
#include <iostream>#include<cstdio>#include<cstring>#include<cmath>#include<algorithm>#include<stack>using namespacestd;structpoint{intx, y; intR;} dt[ -];BOOLJS (Point A, point B) {DoubleL = (a.x-b.x) * (a.x-b.x) + (A.Y-B.Y) * (A.Y-b.y); if(Fabs (sqrt (1.0*L)-(A.R + B.R)) <0.000000001)return true; Else return false;}intmp[ -][ -];intvis[ -];Doubleans;intstart, end;voidDfsintUDoubleEngDoubletot) {Vis[u]=1; if(U = =end) {ans=tot; return; } for(inti =0; I < -; i++){ if(Mp[u][i] &&!Vis[i]) {DFS (I, Eng*DT[U].R/DT[I].R, tot + eng*dt[u].r/DT[I].R); } }}intMain () {intT; scanf ("%d", &T); intN; Point e; while(t--) {scanf ("%d%d%d", &n, &e.x, &e.y); Memset (MP,0,sizeof(MP)); for(inti =0; i < N; i++) {scanf ("%d%d%d", &dt[i].x, &DT[I].Y, &DT[I].R); if(dt[i].x = = e.x && Dt[i].y = =e.y) End=i; if(dt[i].x = =0&& Dt[i].y = =0) Start=i; } for(inti =0; i < N; i++){ for(intj = i +1; J < N; J + +){ if(JS (Dt[i], dt[j])) {//printf ("%d%d\n", I, j);MP[I][J] = Mp[j][i] =1; }}} ans=0; memset (Vis,0,sizeof(VIS)); DFS (Start,10000,10000); printf ("%d\n", (int) ans); } return 0;}