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 1299. Psylonians

WA28....Please Help me!!
Posted by ZiV 29 Jan 2006 15:13
My program passed all tests from forum, but It gets WA28 Here is my code:
Var
 ygol,arm,otkl,energy,us,ensrus,enemys,ensrzapas : int64;
 s : string;
Function Min(x,y : int64):int64;
Begin
 if x > y then
  Min := y
 Else
  Min := x;
End;

Procedure Oxrana;
Begin
 if enemys = 0 then
  Writeln('STOP')
 Else
 if Abs(ygol) < 5 then
  Writeln('FIRE ',Min(20,arm))
 Else
  if ygol > 0 then
   Writeln('LEFT ',Min(100,energy))
  Else
   Writeln('RIGHT ',Min(100,energy));
End;

Procedure Atack;
Begin
 if us*ensrus > enemys*ensrzapas*3 then
  if Abs(ygol) < 10 then
   Writeln('FIRE ',Min(20,arm))
  Else
   Writeln('FRONT ',Min(100,energy))
 Else
  if Abs(ygol) < 5 then
   Writeln('FIRE ',Min(20,arm))
  Else
   Writeln('BACKWARD ',Min(100,energy))
End;

Procedure Defence;
Begin
 if enemys*20 >= Arm then
  if Abs(ygol) < 5 then
   Writeln('FIRE ',Min(20,arm))
  Else
   Writeln('BACKWARD ',Min(100,energy))
 Else
  Oxrana;
End;

Procedure Patrul;
Var
 t : longint;
Begin
 t := otkl;
 if otkl < 0 then
  Otkl := Otkl+360;
 if enemys > 0 then
  Defence
 Else
  if (Otkl>=160) and (otkl <= 200) then
   Writeln('BACKWARD ',Min(100,energy))
  Else
   if ((otkl >= 0) and (otkl <= 20) or (otkl >= 340) and (otkl <= 360)) then
    Writeln('FRONT ',Min(100,energy))
   Else
    if t > 0 then
     Writeln('LEFT ',Min(100,energy))
    Else
     Writeln('RIGHT ',Min(100,energy));
End;

BEGIN
 Readln(Energy,Arm);
 Readln(s);
 Read(enemys,ensrzapas,ygol);
 if Pos('A',s) <> 0 then
  Begin
   Read(us,ensrus);
   Atack;
  End;
 if Pos('D',s) <> 0 then
  Defence;
 if Pos('G',s) <> 0 then
  Oxrana;
 if Pos('P',s) <> 0 then
  Begin
   Read(otkl);
   Patrul;
  End;
END.
Re: WA28....Please Help me!!
Posted by Borisov Nikita 30 Jan 2006 02:36
This test, please:

4 100
P
0 123 45
128

I hope it'll help you! :)))
Re: WA28....Please Help me!!
Posted by alp 11 Nov 2013 14:43
RIGHT 4