Why does this not work?
Posted by
asif 15 May 2002 00:10
# include <stdio.h>
# include <math.h>
int main(void)
{
int i,fi,j,fj,n;
long double A1,A2,B1,B2,a1,a2,r1,r2;
scanf("%d%d%d%d",&i,&fi,&j,&fj);
r1=(1+sqrt(5))/2;
r2=(1-sqrt(5))/2;
A1=powl(r1,i);
A2=powl(r1,j);
B1=powl(r2,i);
B2=powl(r2,j);
a1=(B1*fj-B2*fi)/(A2*B1-A1*B2);
a2=(A2*fi-A1*fj)/(A2*B1-A1*B2);
scanf("%d",&n);
printf("%.0Lf\n",a1*powl(r1,n)+a2*powl(r2,n));
return 0;
}