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

他不许你在循环里对循环变量赋值

Posted by hawk at 2004-12-01 20:45:06 on Problem 2138
In Reply To:想不通,居然会Compile Error???? Posted by:pcxjx at 2004-12-01 20:38:33
> 在本人的机器上没有问题,结果一提交就:
> Borland Delphi Version 15.0
> Copyright (c) 1983,2002 Borland Software Corporation
> 
> C:\temp\270956\Main.pas(1) 
> C:\temp\270956\Main.pas(1) 
> C:\temp\270956\Main.pas(1) 
> C:\temp\270956\Main.pas(13) Error: Assignment to FOR-Loop variable 'i'
> 
> C:\temp\270956\Main.pas(34) 
> 
> 
> Program p2138(Input,Output);
>  var m,n,p,ki,kj:integer;
>      sa:array[0..1008] of string[88];
>      tz,lz:array[0..1008] of integer;
>      ly:array[0..1008] of boolean;
>    Function Pk(x,y:integer):boolean;
>     var i,j:integer;
>      begin
>      i:=0; pk:=false;
>      for i:=1 to lz[y] do
>       if sa[x,i]<>sa[y,i] then begin
>        for j:=i to lz[y] do if sa[x,j+1]<>sa[y,j] then exit;
>        i:=lz[y]+1              end;
>      Pk:=true;
>      end;
>   Begin
>   readln(n,sa[0]); delete(sa[0],1,1); m:=1; lz[0]:=3;
>    for ki:=1 to n do
>     begin readln(sa[m]); lz[m]:=length(sa[m]);  if lz[m]>3 then inc(m) 
> 
>  end;
>     n:=m-1; p:=1; tz[1]:=0; fillchar(ly,sizeof(ly),1); m:=2;
>    while p<m do
>     begin
>     for ki:=n downto 1 do
>      if (ly[ki]) and (lz[ki]=lz[tz[p]]+1) and Pk(ki,tz[p]) then
>         begin   tz[m]:=ki; ly[ki]:=false;  inc(m) end;
>     inc(p);
>     end;
>    writeln(sa[tz[p-1]])
>   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