B - Frogger
#include<set> #include<queue> #include<stack> #include<cmath> #include<vector> #include<cstdio> #include<cstdlib> #include<iostream> #include<algorithm> using namespace std; double map[205][205]; int n; struct edge{ int x,y; }s[205]; int main(){ int cas=0; while(scanf("%d",&n)&&n){ for(int i=1;i<=n;i++) scanf("%d%d",&s[i].x,&s[i].y); for(int i=1;i<=n;i++) for(int j=i+1;j<=n;j++) map[i][j]=map[j][i]=sqrt(double(s[i].x-s[j].x)*(s[i].x-s[j].x)+double(s[i].y-s[j].y)*(s[i].y-s[j].y)); for(int k=1;k<=n;k++) for(int i=1;i<=n-1;i++) for(int j=1;j<=n;j++) if(map[i][j]>map[i][k]&&map[i][j]>map[k][j]){ if(map[i][k]>map[k][j]) map[j][i]=map[i][j]=map[i][k]; else map[j][i]=map[i][j]=map[k][j]; } printf("Scenario #%d\n",++cas); printf("Frog Distance = %.3f\n\n",map[1][2]); } return 0; }
细雨斜风作晓寒。淡烟疏柳媚晴滩。入淮清洛渐漫漫。
雪沫乳花浮午盏,蓼茸蒿笋试春盘。人间有味是清欢。