Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
rt 疯了 如何优化???(pascal)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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator