Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

rt 疯了 如何优化???(pascal)

Posted by ysq1234 at 2007-03-05 21:50:13 on Problem 2575
Program ex;
var
  b:Array[1..3000] Of Word;
  a:Array[1..3000] Of Integer;
  m, i, s, t:Integer;
  Flag:Boolean;
Begin
  While not Eof Do Begin
    Read(m);
    For i:=1 to m Do Read(a[i]);
    t :=0;
    Flag := true;
    Repeat
      Inc(t);
      s:= abs(a[t + 1] - a[t]);
      If b[s] = 1 Then Begin
        Writeln('Not jolly');
        flag := False;
        Break;
      End Else b[s] := 1;
    Until (t = m - 1);
    If Flag = True Then Writeln('Jolly');
    For i:=1 to m Do Begin
      a[i] := 0;
      b[i] := 0;
    End;
  End;
End.

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator