package bc;
public class pro {
int t,datanumber;
int s,sx,c,n,cx,nx,cxs,nxs,sxs;
double e1;
double[][][][] v=new double[599][3][10][150];
int[][][][] gotoc=new int[599][3][10][150];
int[][][][] gotos=new int[599][3][10][150];
int[][][][] goton=new int[599][3][10][150];
double[] point=new double[5000];
double minp,maxp,delta;
public static void main(String[] args) {
pro test=new pro();
}
pro(){
datanumber=100;
int h,z;
double v1,minv;
for(s=1;s<101;s++){
for(c=1;c<3;c++){
for(n=0;n<10;n++){
v[1][c][n][s]=999999;
}
}
}
minp=100;
maxp=200;
delta=(maxp-minp);
double p1;
for(s=1;s<101;s++){
for(c=1;c<3;c++){
p1=minp+delta*s;
e1=(point[1]-p1)*(point[1]-p1);
v[1][c][0][s]=e1;
}
}
for(t=2;t<datanumber+1;t++){
for(s=1;s<101;s++){
for(c=1;c<3;c++){
for(n=0;n<10;n++){
p1=minp+delta*s;
e1=(point[1]-p1)*(point[1]-p1);
minv=99999;
cxs=0;
sxs=0;
nxs=0;
for(sx=1;sx<101;sx++){
for(cx=1;cx<3;cx++){
z=0;
h=0;
if(c==1)h=h+1;
if(sx>s)h=h+1;
if(h==2)z=100;
h=0;
if(c==2)h=h+1;
if(s>sx)h=h+1;
if(h==2)z=100;
h=0;
if(c==cx)h=100;
if(h>50)nx=n;
if(h<50)nx=n-1;
if(nx<0)z=100;
if(nx<0)nx=0;
v1=e1+v[s-1][cx][nx][sx];
if(z>50)v1=99999;
if(v1<minv)cxs=cx;
if(v1<minv)sxs=sx;
if(v1<minv)nxs=nx;
if(v1<minv)minv=v1;
}
}
v[s][c][n][s]=minv;
gotos[s][c][n][s]=sxs;
goton[s][c][n][s]=nxs;
gotoc[s][c][n][s]=cxs;
}
}
}
}
}
}
最終更新:2014年03月06日 08:57