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

Help!Help!Help!我的程序一直WA,帮忙看看啦!Thanks!

Posted by yanghuan at 2006-08-07 00:41:51 on Problem 1282
Program Lx;
Type
  Arr=Array[1..250] Of Longint;
Var
  a: Array[1..250, 1..250] Of Longint;
  b, c: Arr;
  i, j: Longint;
  n, p: Longint;
  f: Boolean;
Begin
  Readln(n, p);
  For i:=1 To n Do Begin
    For j:=1 To p Do Read(a[i, j]);
    Readln;
  End;
  For i:=1 To n Do Begin
    b[i] := i;
    c[i] := i;
  End;
  For i:=1 To 1000000000 Do Begin
    For j:=1 To n Do c[j] := a[c[j], (i - 1) Mod p + 1];
    f := true;
    For j:=1 To n Do
      If (b[j] <> c[j]) Then Begin
        f:=false;
        break;
      end;
    If (f) then Begin
    Writeln(i);
    Exit;
    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