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

Why WA?

Posted by yanghuan at 2006-11-15 23:14:30 on Problem 2769
Program Lx;
Var
  t, n, k, Max, i, j: Longint;
  a: Array[1..1000000] 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 i:=1 To n Do Begin
      Read(a[i]);
      If (a[i] > Max) Then Max := a[i];
    End;
    Readln;
    For k:=1 To Max Do Begin
      f := True;
      Fillchar(b, Sizeof(b), False);
      For i:=1 To n Do Begin
        If (b[a[i] Mod k]) Then Begin f := False; Break; End;
        b[a[i] Mod k] := True;
      End;
      If (f) Then Begin Writeln(k); Break; End; 
    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