package deracinema;
public class bud{
int th1[]=new int[6];
int th2[]=new int[6];
int c[][]=new int[6][6];
int y1[][]=new int[6][6];
int y2[][]=new int[6][6];
double h;
double maxv;
int[][] alpha=new int[6][2000];
int[][] beta=new int[6][2000];
int[][] theta=new int[6][2000];
int[][] b=new int[6][2000];
int s1,s2,t1,t2,t3,tx,number;
int[][] nu=new int[6][2000];
int[][] nw=new int[6][2000];
int[] nws=new int[6];
int upper[][]=new int[6][6];
double[][] u=new double[6][2000];
double[][][] v=new double[6][21][21];
double[][][] delta=new double[6][6][11];
int sx,sxs,bxs,bx,j;
double u1,v1;
void makedata(int s1,int dx){
for(s2=1;s2<6;s2++){
tx=0;
for(t1=-5;t1<6;t1++){
for(t2=-5;t2<6;t2++){
for(t3=-5;t3<6;t3++){
tx=tx+1;
alpha[s2][tx]=y1[s1][s2]+t1;
beta[s2][tx]=y2[s1][s2]+t2;
theta[s2][tx]=c[s1][s2]+t3;
b[s2][tx]=t1+t2-t3;
}
}
}
number=tx;
}
for(s2=1;s2<6;s2++){
for(tx=1;tx<number+1;tx++){
u[s2][tx]=u(s1,s2,alpha[s2][tx],beta[s2][tx],theta[s2][tx]);
}
}
for(s2=1;s2<6;s2++){
for(tx=1;tx<number+1;tx++){
nu[s2][tx]=nearu(s1,s2,alpha[s2][tx],beta[s2][tx],theta[s2][tx]);
}
}
int np;
for(s2=1;s2<6;s2++){
for(tx=1;tx<number+1;tx++){
if(upper[s1-1][s2]>nu[s2][tx])u[s2][tx]=-999;
}
}
int n,nx;
for(s2=1;s2<6;s2++){
for(tx=1;tx<number+1;tx++){
n=nearu(s1+1,s2,alpha[s2][tx],beta[s2][tx],theta[s2][tx]);
nx=upper[s1][s2];
if(n>nx)u[s2][tx]=-999;
}
}
for(s2=1;s2<5;s2++){
for(tx=1;tx<number+1;tx++){
nw[s2][tx]=nearu(s1,s2+1,alpha[s2][tx],beta[s2][tx],theta[s2][tx]);
}
}
for(s2=1;s2<5;s2++){
nws[s2]=nearu(s1,s2+1,y1[s1][s2],y2[s1][s2],c[s1][s2]);
}
s2=1;
for(sx=-10;sx<11;sx++){
for(bx=-10;bx<11;bx++){
maxv=-999;
for(tx=1;tx<number+1;tx++){
j=100;
if(b[s2][tx]==bx)j=0;;
if(nw[s2][tx]>nws[s2]+sx)j=100;
u1=-999;
if(j<50)u1=u[s2][tx];
if(u1>maxv)maxv=u1;
}
v[s2][sx+10][bx+10]=maxv;
}
}
for(s2=2;s2<6;s2++){
for(sx=-10;sx<11;sx++){
for(bx=-10;bx<11;bx++){
maxv=-999;
for(tx=1;tx<number+1;tx++){
u1=u[s2][tx];
if(nw[s2][tx]>nws[s2]+sx)u1=-999;
bxs=bx-b[s2][tx];
j=0;
if(bxs>10)j=100;
if(bxs<-10)j=100;
if(j>60)bxs=0;
sxs=nu[s2][tx]-nws[s2-1];
if(sxs>10)sxs=10;
if(sxs<-10)j=100;
if(j>60)sxs=0;
v1=u1+v[s2-1][sxs+10][bxs+10];
if(j>60)v1=-999;
if(v1>maxv)maxv=v1;
}
v[s2][sx+10][bx+10]=maxv;
}
}
}
bx=dx;
maxv=-999;
for(sx=-10;sx<11;sx++){
if(v[5][sx+10][bx+10]>maxv)maxv=v[5][sx+10][bx+10];
}
}
int nearu(int s1,int s2,int z1,int z2,int cx){
int n;
double u1,cs;
u1=u(s1,s2,z1,z2,cx);
cs=Math.exp(u1);
n=(int)(cs/h);
return n;
}
double u(int s1,int s2,int z1,int z2,int cx){
double u1;
double c1,x1,x2;
int z;
u1=0;
c1=cx*h;
x1=1-(double)z1/th1[s1];
x2=1-(double)z2/th2[s2];
z=0;
if(x1>1)z=100;
if(x1<0.01)z=100;
if(x2>1)z=100;
if(x2<0.01)z=100;
if(c1<0.01)z=100;
u1=-999;
if(z<50)u1=Math.log(c1)+Math.log(x1)+Math.log(x2);
return u1;
}
}
最終更新:2013年08月16日 23:31