class game{
public static void main(String args[]){
double startc,startk;
double pp;
double c1,c2,c3;
double cx,k1;
double a,beta;
double r1;
int s,t;
a=0.33;
beta=0.95;
c1=0.1;
c2=10;
startk=10;
startc=c1;
pp=check(startc,startk);
startc=c2;
pp=check(startc,startk);
s=0;
while(s<50){
c3=(c1+c2)/2;
startc=c3;
pp=check(startc,startk);
if(pp<50)c1=c3;
if(pp>50)c2=c3;
s=s+1;
}
t=0;
k1=startk;
cx=c1;
while(t<100){
k1=k1+Math.pow(k1,a)-cx;
r1=a*Math.pow(k1,a-1);
cx=cx*(beta*(1+r1));
t=t+1;
System.out.println(cx);
}
}
static double check(double startc,double startk){
int t;
double pp;
double k1,cx,r1;
double a,beta;
a=0.33;
beta=0.95;
cx=startc;
k1=startk;
t=0;
pp=0;
while(t<200){
k1=k1+Math.pow(k1,a)-cx;
r1=a*Math.pow(k1,a-1);
cx=cx*(beta*(1+r1));
if (k1<0)pp=100;
t=t+1;
}
return pp;
}
}
最終更新:2010年01月22日 23:04