int main(){ const int iLen=7; Point p[iLen+1];//// Pointer List p[1]=Point(0,6); p[2]=Point(1,0); p[3]=Point(2,3); p[4]=Point(5,4); p[5]=Point(6,1); p[6]=Point(7,5); p[7]=Point(8,2); //////////////To minimize the time of Debugging We get parameters initialize double a[iLen+1][iLen+1]={}; ////null-filled for(int j=3;j<=iLen;j++){ for(int i=1;i<=j-2;i++){ a[i][j]=a[i][j-1]+dist(p[j-1],p[j]); } a[j-1][j]=MAX_VALUE;
# include <bits/stdc++.h> using namespace std; # define abs(a) ((a)>0?(a):-(a))
const int N = 1000+7; /***********************************************************************/ double dp[N][N]; //dp[i][j]为i点到1点,再从1点到j点的最短距离, double d[N][N]; //d[i][j] 为 i->j的距离 struct point{ double x, y; }a[N];
double dis(int i, int j){ return(sqrt((a[i].x-a[j].x)*(a[i].x-a[j].x)+(a[i].y-a[j].y)*(a[i].y-a[j].y))); } int main() { int _,n; //scanf("%d",&_); while(~scanf("%d", &n)){ for(int i = 1; i <= n; i++) scanf("%lf %lf", &a[i].x, &a[i].y);
for(int i = 1; i <= n; i++) for(int j = 1; j <= n; j++) d[i][j] = dis(i, j);
# include <bits/stdc++.h> using namespace std; # define abs(a) ((a)>0?(a):-(a))
const int N = 1000+7; /***********************************************************************/ int dp[N][N]; //dp[i][j]为i点到1点,再从1点到j点的最短距离, int d[N][N]; //d[i][j] 为 i->j的距离 struct point{ int x, y; }a[N];
int dis(int i, int j){ int p,q; if(a[i].y>a[j].y) q=(360+a[j].y-a[i].y)%360; else q=(360+a[i].y-a[j].y)%360; p=abs(a[i].y-a[j].y)>q?q:abs(a[i].y-a[j].y); return (abs(a[i].x-a[j].x)*400+p); } int main() { int _,n; scanf("%d",&_); while(_--){ scanf("%d", &n); a[1].x=0,a[1].y=0; for(int i = 2; i <= n+1; i++) scanf("%d %d", &a[i].x, &a[i].y);
for(int i = 1; i <= n+1; i++) for(int j = 1; j <= n+1; j++) d[i][j] = dis(i, j);