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 |
Why TLEProgram Lx; Var t, n, k, Max, i, j: Longint; a: Array[1..1000] Of Longint; b: Array[0..1000000] Of Boolean; f: Boolean; Begin Readln(t); For i:=1 to t Do Begin Readln(n); Max := 0; For j:=1 To n Do Begin Read(a[j]); If (a[j] > Max) Then Max := a[j]; End; Readln; For k:=1 To Max Do Begin f := True; Fillchar(b, Sizeof(b), False); For j:=1 To n Do Begin If (b[a[j] Mod k]) Then Begin f := False; Break; End; b[a[j] Mod k] := True; End; If (f) Then Begin Writeln(k); Break; End; 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