ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1192. Ball in a Dream

Where is mistake?
Posted by Peter Obuhov 3 Mar 2002 02:05
From physics:

X=V*Cos(A)*T
Y=V*Sin(A)*T-g*t^2/2

When ball is on the ground Y=0. So

0=V*Sin(A)*T-g*t^2/2  ==>   V*Sin(A)=G*t/2
==>  t=V*Sin(A)*2/G

X=V*Sin(A)*T = V*V*Sin(A)*Cos(A)*2/G

Sin(2A)=2Sin(A)*Cos(A), so:

X=V*V*Sin(2A)/G

Kinetic energy is m*V^2/2
It is decresead K times:

E1/E2=K

(M*V^2/2)/(M*V1^2/2)=k  ==>   V1=V/Sqrt(K)

So I wrote this program:

Var
 Sin2A,Len,V,K,T,X,A,Pii: Real;
begin
 Read(V,A,K);
 Len:=0;
 Pii:=3.1415926535;
 Sin2A:=Sin(A*Pii/90);
 Repeat
  X:=V*V*Sin2A/10;
  Len:=Len+X;
  V:=V/Sqrt(K);
 Until X<0.01;
 WriteLn(Len:0:2);
end.

It works good on test from example (5 15 2.50)
But it receivs [Wrong answer] :((

Help...
Re: Where is mistake?
Posted by meoden 3 Mar 2002 08:30
> Var
>  Sin2A,Len,V,K,T,X,A,Pii: Real;
> begin
>  Read(V,A,K);
>  Len:=0;
>  Pii:=3.1415926535;
>  Sin2A:=Sin(A*Pii/90);
>  Repeat
>   X:=V*V*Sin2A/10;
>   Len:=Len+X;
>   V:=V/Sqrt(K);
>  Until X<0.01;       => Write: "Until v<0.001". You'll got AC.
>  WriteLn(Len:0:2);
> end.
Re: Where is mistake?
Posted by Peter Obuhov 3 Mar 2002 13:37
> > Var
> >  Sin2A,Len,V,K,T,X,A,Pii: Real;
> > begin
> >  Read(V,A,K);
> >  Len:=0;
> >  Pii:=3.1415926535;
> >  Sin2A:=Sin(A*Pii/90);
> >  Repeat
> >   X:=V*V*Sin2A/10;
> >   Len:=Len+X;
> >   V:=V/Sqrt(K);
> >  Until X<0.01;       => Write: "Until v<0.001". You'll got AC.
> >  WriteLn(Len:0:2);
> > end.
>
Thank You! ;)
Re: Where is mistake?
Posted by Yuan 13 Mar 2002 20:34
u can use formula: len = sin(a) * cos(a) * sqr(v) * k / (k - 1) / 5;
Why the pi must be 3.1415926535 but not the pi in pascal?
Posted by Lucky 22 Jan 2003 18:43
Re: Why the pi must be 3.1415926535 but not the pi in pascal?
Posted by Dumitran Daniel 28 Mar 2003 20:38
> deaia
Re: Where is mistake?
Posted by xDEMONx [Perm SU] 10 Aug 2009 02:12
You must use eps more than 0,01(for example 1E-10)