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 1083. Factorials!!!

whi my program is wrong?can enibody halp meeeeeeeeeee?????
Posted by I am david. Tabo. 12 Apr 2002 21:57
var g,h,i,j,l,m,n:integer;
    k:longint;
    sg,si:byte;
    s:string;

procedure readdata;
  begin
    readln (n,s);
  end;

procedure solve;
  begin
    sg:=length(s)-1;
    k:=n;
    g:=1;
    for j:=1 to n div 2 do
      begin
        if sg mod n <> 0 then
          begin
            if j=n div 2 then
              k:=k*(n mod sg)
            else
              if n>j*sg then
                k:=k*(n-j*sg)
              else
                if k=0 then
                  begin
                    k:=0;
                    exit;
                  end;
          end
        else
          begin
            if j=n div 2 then
              k:=k*sg
            else
              if n>j*sg then
                k:=k*(n-j*sg)
              else
                if k=0 then
                  begin
                    k:=0;
                    exit;
                  end;
          end;
      end;
  end;

procedure print;
  begin
    writeln (k);
  end;
begin
  readdata;
  solve;
  print;
end.