アットウィキロゴ

v23pp

package dex;
 
public class pro {
 
 int[] point=new int[11];
 int[] p=new int[11];   
 double[][] v=new double[11][11];
 int[][] gotox=new int[11][11];  
 int[] op=new int[11];
 
    public static void main(String[] args) {
       pro t=new pro();
    }
    pro(){
 
 
        int s;
 
        for(s=1;s<11;s++){
        point[s]=s;    
        p[s]=5;
        }
 
        int tr;
 
        for(tr=1;tr<101;tr++){
 
        s=1;
        int sx;
        for(sx=1;sx<11;sx++){
        v[1][sx]=(sx-point[1])*(sx-point[1])+(sx-p[1])*(sx-p[1]);    
        }
int tx;
for(s=2;s<11;s++){
for(sx=1;sx<11;sx++){
double u1=(sx-point[s])*(sx-point[s])+(sx-p[s])*(sx-p[s]);    
double minv=99999;
int txs=0;
for(tx=1;tx<11;tx++){        
double e1=(sx-tx)*(sx-tx);
double v1=u1+v[s-1][tx];
if(e1>1)v1=999999;
if(v1<minv)txs=tx;
if(v1<minv)minv=v1;
} 
v[s][sx]=minv;
gotox[s][sx]=txs;
}        
}
 
double minv=9999;
int sxs=0;
for(sx=1;sx<11;sx++){
if(v[10][sx]<minv)sxs=sx;    
if(v[10][sx]<minv)minv=v[10][sx];
}
 
op[10]=sxs;
for(s=1;s<10;s++){
int t=11-s;
sx=op[t];
op[t-1]=gotox[t][sx];
}
 
 
for(s=1;s<11;s++){
p[s]=op[s];    
System.out.println(s+","+p[s]);
}
 
 
        }
 
 
 
 
    }
 
 
 
}
 
最終更新:2016年08月01日 09:15