class pro{
public static void main(String args[]){
int s;
int n1,n2;
double th[]=new double[101];
double beta;
double p,x,c;
double u1;
double rev;
double maxrev;
int nx1,nx2;
beta=1;
nx1=0;
nx2=0;
maxrev=0;
for (n1=1;n1<50;n1++){
for (n2=1;n2<11;n2++){
p=n1;
c=n2;
for (s=1;s<101;s++){
th[s]=s;
}
rev=0;
for (s=1;s<101;s++){
x=(th[s]-p)/(2*beta);
if (x<0)x=0;
u1=th[s]*x*x-beta*x-p*x-c;
if (u1<0)x=0;
rev=rev+p*x+c;
}
if (rev>maxrev)nx1=n1;
if (rev>maxrev)nx2=n2;
if (rev>maxrev)maxrev=rev;
}
}
System.out.println(maxrev);
}
}
最終更新:2010年07月12日 07:59