アットウィキロゴ

071310

class pro{
public static void main(String args[]){
int s;
double beta;
double maxr;
double u1;
int n1,n2;
double p,x,c,px,cx;
double r1,r2;
double th[]=new double[101];
double q[]=new double[101];
double t[]=new double[101];
for (s=1;s<101;s++){
th[s]=s;
}
beta=2;
maxr=0;
px=0;
cx=0;
for (n1=1;n1<20;n1++){
for (n2=1;n2<50;n2++){
c=n1;
p=n2;
r2=0;
for (s=1;s<101;s++){
x=(th[s]-p)/(2*beta);
if (x<0)x=0;
u1=th[s]*x-beta*x*x-p*x-c;
if (u1<0)x=0;
r1=p*x+c;
if (x==0)r1=0;
r2=r2+r1;
}
if (r2>maxr)px=p;
if (r2>maxr)cx=c;
if (r2>maxr)maxr=r2;
}
}

p=px;
c=cx;
for (s=1;s<101;s++){
x=(th[s]-p)/(2*beta);
if (x<0)x=0;
u1=th[s]*x-beta*x*x-p*x-c;
if (u1<0)x=0;
r1=p*x+c;
if (x==0)r1=0;
q[s]=x;
t[s]=r1;
}




}
}
最終更新:2010年07月13日 16:46