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 1010. Discrete Function

HELP !!!!!!! I don't know why I get wrong answer
Posted by Cross 26 May 2002 08:56

var b,c,d:comp;
    a,n:longint;
    b1,c1:longint;
    r:comp;
procedure init;
begin
  {assign(input,'1010.in');
  reset(input);}
  readln(n);
  read(b);read(c);
  r:=c-b;
  c1:=2;
  for a:=3 to n do
  begin
    read(d);
    if (d-c)>r then
    begin
      r:=(d-c);
      c1:=a;
    end;
    c:=d;
  end;
  writeln(c1-1,' ',c1);
end;
begin
  init;
end.
Re: HELP !!!!!!! I don't know why I get wrong answer
Posted by Ivan Georgiev 27 May 2002 23:01
1. change d-c to abs(d-c)
2. change longint to double

good luck.