@LK: It looks like you are assuming that the maximum range will occur if he throws the arrows upwards at a 45 degree angle. While this provides the maximum range if H = 0, it does not do so for other values of H. See http://en.wikipedia.org/wiki/Range_of_a_projectile for a derivation of the optimal angle for what they call "uneven ground."
Dave On Mar 4, 2:43 pm, Logic King <crazy.logic.k...@gmail.com> wrote: > I solved the problem https://www.spoj.pl/problems/FTHEELF/ > > i dont know why i am WA..........plz tell why it getting WA.......if there > are cases where my code fails please specify !! > > #include<stdio.h> > #include<math.h> > int main() > { > int v,h; > long double t,d,g=9.8L; > while(1) > { > scanf("%d%d",&v,&h); > if(v==-1&&h==-1) > return 0; > else > { > > t=(2*v*(1/sqrtl(2))+sqrtl((4*v*v*(1/sqrtl(2))*(1/sqrtl(2)))+8*h*g))/(2*g); > d=v*(1/sqrtl(2))*t; > printf("%.6Lf\n",d); > } > } > return 0; > > > > }- Hide quoted text - > > - Show quoted text - -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.