アットウィキロゴ

071401

class pro{
public static void main(String args[]){
int s,n1,n2;
double th[]=new double[101];
double beta;
double x1;
double u1,r1,r2;
double p,c,cost;
double px,cx;
double maxr;
for (s=1;s<101;s++){
th[s]=s;
}
cost=10;
beta=1;
px=0;
cx=0;
maxr=0;
x1=0;
for (n1=1;n1<61;n1++){
for (n2=1;n2<500;n2++){
p=n1;
c=n2;
r2=0;
for (s=1;s<101;s++){
x1=(th[s]-p)/(2*beta);
if (x1<0)x1=0;
u1=th[s]*x1-beta*x1*x1-p*x1-c;
if (u1<0)x1=0;
r1=p*x1+c-cost*x1;
if (x1==0)r1=0;
r2=r2+r1;
}
if (r2>maxr)px=p;
if (r2>maxr)cx=c;
if (r2>maxr)maxr=r2;
}
}
System.out.println(px);
System.out.println(cx);
System.out.println(maxr);




}
}
最終更新:2010年07月14日 06:55