ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1024. Permutations

Help me, I have Compilation Error!!!
Posted by Anton 11 Jun 2002 19:35
-----------------------MY PROGRAM------------------------------------
const k = 200;
var
dob,check,i,j,m,n,l,count:longint;
c,a,b:array [1..k] of integer;
function euclid(_a,_b:integer):integer;
begin
  if _b=0 then euclid:=_a else euclid:=euclid(_b,_a mod _b);
end;
begin
  readln (n);
  for i:=1 to n do read (a[i]);
  while (m<n) do
  begin
    check:=0;
    inc (m);
    if b[m] = 1 then continue;
    l:=m;
    while (check=0) do
    begin
      inc (count);
      b[l]:=1;
      l:=a[l];
      if b[l]=1 then check:=1;
    end;
    inc (j);
    c[j]:=count;
    count:=0;
  end;
  l:=0;
  dob:=1;
  while j> 1 do
    begin
    l:=0;
    for i:=1 to j div 2 do
    begin
      inc (l);
      c[l]:=c[i]*c[i+1] div euclid(c[i],c[i+1]);
     if i+1<j div 2 then inc(i);
    end;
    if j mod 2 = 1 then
    begin
      inc (l);
      c[l]:=c[j];
    end;
    for i:=j div 2 + j mod 2+1 to k do c[i]:=0;
    j:=j div 2 + j mod 2;
  end;
  writeln (c[1]);
end.
I know
Posted by raxtinhac 12 Jun 2002 11:42
see it

[code deleted]

  {hello, you can't change the value i inside the command for i := ..
    your mistake is "inc(i)" , use another way}

[code deleted]

Edited by moderator 04.12.2019 21:20
Re: Help me, I have Compilation Error!!!
Posted by misha 27 Oct 2002 11:36
Are you Anton Zelenov?