Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

果然很水啊~~

Posted by wsj19911101 at 2011-03-04 12:50:44 on Problem 2502
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator