class pro{
public static void main(String args[]){
double h;
double a[][]=new double[402][802];
int p2[]=new int[401];
int p3[]=new int[401];
int s,m,n,j,px;
double cs,ys;
double y1,y2;
double maxv,minv;
double x1,x2,z;
double th[]=new double[11];
double c[]=new double[11];
double y[]=new double[11];
int maxn,maxm;
int t1,t2;
int p1;
for (s=1;s<11;s++){
th[s]=1+0.1*s;;
}
for (s=1;s<11;s++){
c[s]=0.5*th[s];
y[s]=0.5*th[s];
}
h=0.04;
t2=0;
while(t2<5){
h=h/2;
for (m=0;m<402;m++){
for (n=0;n<802;n++){
a[m][n]=0;
}
}
for (m=1;m<401;m++){
a[m][m]=1;
}
for (m=1;m<402;m++){
a[m][m+400]=1;
}
for (m=1;m<401;m++){
a[m][0]=h;
}
for (s=1;s<11;s++){
for (j=1;j<11;j++){
n=40*(s-1)+j;
a[401][n]=1;
a[401][n+10]=-1;
a[401][n+20]=-1;
a[401][n+30]=1;
}
}
a[401][0]=0;
for (s=1;s<11;s++){
for (j=1;j<11;j++){
n=40*(s-1)+j;
a[0][n]=(Math.log(c[s]+j*h)-Math.log(c[s]+(j-1)*h))/h;
a[0][n+10]=(Math.log(c[s]-j*h)-Math.log(c[s]-(j-1)*h))/h;
y1=y[s]+j*h;
y2=y[s]+(j-1)*h;
a[0][n+20]=(Math.log(1-y1/th[s])-Math.log(1-y2/th[s]))/h;
y1=y[s]-j*h;
y2=y[s]-(j-1)*h;
a[0][n+30]=(Math.log(1-y1/th[s])-Math.log(1-y2/th[s]))/h;
}
}
maxv=0;
maxn=999;
for (n=1;n<802;n++){
if (a[0][n]>maxv)maxn=n;
if (a[0][n]>maxv)maxv=a[0][n];
}
System.out.println(maxn);
t1=0;
while(t1<10000){
minv=999;
maxm=9999;
for (m=1;m<402;m++){
x1=a[m][maxn];
px=0;
if (x1==0)px=100;
if (x1<0)px=100;
if (px>50)x1=1;
x2=a[m][0]/x1;
if (px>50)x2=1000;
if (x2<0)x2=1000;
if (x2<minv)maxm=m;
if (x2<minv)minv=x2;
}
System.out.println(maxm);
for (m=0;m<402;m++){
z=a[m][maxn]/a[maxm][maxn];
if (maxm==m)z=0;
for (n=0;n<802;n++){
a[m][n]=a[m][n]-z*a[maxm][n];
}
}
maxv=0;
maxn=999;
for (n=1;n<802;n++){
if (a[0][n]>maxv)maxn=n;
if (a[0][n]>maxv)maxv=a[0][n];
}
System.out.println(maxn);
if (maxn>900)t1=100000;
}
for (n=1;n<401;n++){
p1=0;
p3[n]=0;
for (m=1;m<402;m++){
if (a[m][n]==0)p1=p1+1;
if (a[m][n]>0)p3[n]=m;
if (a[m][n]<0)p3[n]=m;
}
p2[n]=0;
if (p1==400)p2[n]=100;
}
for (s=1;s<11;s++){
for (j=1;j<11;j++){
n=40*(s-1)+j;
m=p3[n];
if (p2[n]>50)c[s]=c[s]+a[m][0]/a[m][n];
}
}
for (s=1;s<11;s++){
for (j=11;j<21;j++){
n=40*(s-1)+j;
m=p3[n];
if (p2[n]>50)c[s]=c[s]-a[m][0]/a[m][n];
}
}
for (s=1;s<11;s++){
for (j=21;j<31;j++){
n=40*(s-1)+j;
m=p3[n];
if (p2[n]>50)y[s]=y[s]+a[m][0]/a[m][n];
}
}
for (s=1;s<11;s++){
for (j=31;j<41;j++){
n=40*(s-1)+j;
m=p3[n];
if (p2[n]>50)y[s]=y[s]-a[m][0]/a[m][n];
}
}
for (s=1;s<11;s++){
System.out.println(c[s]);
System.out.println(y[s]);
}
t2=t2+1;
}
}
}
最終更新:2010年06月25日 16:42