class pro{
public static void main(String args[]){
double c1,l1,trs;
int s,n;
double th[]=new double[101];
double tl[]=new double[11];
double tr[]=new double[11];
for (s=1;s<101;s++){
th[s]=0.02*s;
}
for (n=0;n<11;n++){
tl[n]=0.35;
}
trs=0.1;
tr[0]=trs;
for(n=1;n<11;n++){
tr[n]=(1-tl[n-1])*0.1*n+tr[n-1]-(1-tl[n])*0.1*n;
}
c1=con(th[50],tl,tr);
System.out.println(c1);
}
public static double con(double th1,double[] tl,double[] tr){
double l1,y1,c1,u1,maxu,maxc;
int n;
maxu=-999;
maxc=0;
for (n=0;n<10;n++){
l1=lx(th1,tl[n],tr[n]);
y1=th1*l1;
if(y1<0.1*n)y1=0.1*n;
if(y1>0.1*(n+1))y1=0.1*(n+1);
c1=(1-tl[n])*y1+tr[n];
u1=u(c1,1-y1/th1);
if (u1>maxu)maxc=c1;
if (u1>maxu)maxu=u1;
}
l1=lx(th1,tl[10],tr[10]);
y1=th1*l1;
if(y1<1)y1=1;
c1=(1-tl[10])*y1+tr[10];
u1=u(c1,1-y1/th1);
if (u1>maxu)maxc=c1;
return maxc;
}
public static double lab(double th1,double[] tl,double[] tr){
double l1,y1,c1,u1,maxu,maxl;
int n;
maxu=-999;
maxl=0;
for (n=0;n<10;n++){
l1=lx(th1,tl[n],tr[n]);
y1=th1*l1;
if(y1<0.1*n)y1=0.1*n;
if(y1>0.1*(n+1))y1=0.1*(n+1);
c1=(1-tl[n])*y1+tr[n];
u1=u(c1,1-y1/th1);
if (u1>maxu)maxl=y1/th1;
if (u1>maxu)maxu=u1;
}
l1=lx(th1,tl[10],tr[10]);
y1=th1*l1;
if(y1<1)y1=1;
c1=(1-tl[10])*y1+tr[10];
u1=u(c1,1-y1/th1);
if (u1>maxu)maxl=y1/th1;
return maxl;
}
public static double lx(double th1,double tlp,double trp){
double w1,l1;
w1=(1-tlp)*th1;
l1=(w1-trp)/(2*w1);
if (l1<0)l1=0;
return l1;
}
public static double u(double c1,double x1){
double c2,x2,z2,u2;
c2=c1;
x2=x1;
z2=0;
if (c2<0)z2=100;
if (c2==0)z2=100;
if (x2>1)z2=100;
if (x2<0)z2=100;
if (x2==0)z2=100;
if (z2>50)c2=0.01;
if (z2>50)x2=0.5;
u2=Math.log(c2)+Math.log(x2);
if (z2>50)u2=-999;
return u2;
}
}
最終更新:2010年04月15日 18:56