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

WA#13. Please, help me find my misteke...
Posted by Марина 3 Feb 2005 22:43
This is my program:
type int = longint;

var n, p, x, np, m, mp, yg : int;
    ch : char;

procedure guard;
begin
  if m = 0 then begin writeln('STOP'); exit; end;
  if abs(yg) < 5 then
    writeln('FIRE ', p)
  else begin
    if yg >= 5 then writeln('LEFT ', x);
    if yg <= -5 then writeln('RIGHT ', x);
  end;
end;

procedure backward;
begin
  if abs(yg) < 5 then
    writeln('FIRE ', p)
  else
    writeln('BACKWARD ', x);
end;

procedure front;
begin
  if abs(yg) < 10 then
    writeln('FIRE ', p)
  else
    writeln('FRONT ', x);
end;

procedure defence;
begin
  if n*20 >= p then backward else guard;
end;

procedure ataka;
begin
  readln(n, np);
  if n*np > m*mp*3 then front
  else backward;
end;

procedure patryl;
begin
  readln(yg);
  if x > 100 then x := 100;
  if abs(yg) > 20 then begin
    if yg < -90 then yg := -90 - yg else
      if yg > 90 then yg := 90 - yg;
    if yg < 0 then writeln('LEFT ', x)
    else writeln('RIGHT ', x)
  end
  else writeln('FRONT ', x);
end;

BEGIN
  readln(x, p);
  readln(ch);
  readln(m, mp, yg);
  if p > 20 then p := 20;
  if x > 100 then x := 100;
  case ch of
    'P' : patryl;
    'A' : ataka;
    'G' : guard;
    'D' : defence;
  end;
END.
Oh! You have not right answer on sample test... (+)
Posted by Victor Barinov (TNU) 4 Feb 2005 15:14
Oh! You have not right answer on sample test

100 100
P
0 0 0
-100


And try this tests:

68 9
D
2688 70 -166

14 7
D
4193 6 97

129 34
P
7209 68 -20
-128

4 23
P
3609 27 -89
103


My AC program outputs:

BACKWARD 68

BACKWARD 14

BACKWARD 100

BACKWARD 4
Re: Oh! You have not right answer on sample test... (+)
Posted by jedimastex 6 Feb 2005 12:37
That's right