Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
果然很水啊~~#include<cstdio> #include<cmath> #include<cstring> struct t{ double x; double y; }p[202]; int i,j,x,n,vi[202]={0},min,v[202][202]={0}; double d[202],y; int main() { memset(d,9999999,sizeof(d)); d[0]=0; scanf("%lf%lf%lf%lf",&p[0].x,&p[0].y,&p[1].x,&p[1].y); n=2;x=0; while(scanf("%lf%lf",&p[n].x,&p[n].y)>0){ if(x&&p[n].x+p[n].y>0){v[x][n]=3;v[n][x]=3;x=n;n++;} else if(p[n].x+p[n].y>0){x=n;n++;} else x=0; } for(i=0;i<n;i++){ min=9999999; for(j=0;j<n;j++)if(!vi[j]&&d[j]<min)min=d[x=j]; vi[x]=1; for(j=0;j<n;j++){ y=d[x]+sqrt((p[j].x-p[x].x)*(p[j].x-p[x].x)+(p[j].y-p[x].y)*(p[j].y-p[x].y))/(v[x][j]+1)/10000*60; d[j]=d[j]<y?d[j]:y; } } printf("%.0lf\n",d[1]); } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator