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 i get CM and what is wrong to my program,enubody can help meeeeeeeeeeeeeeeee!!!!!!!!!!!!!!!!!!!!!#????????????????????
Posted by I am david. Tabo. 12 Apr 2002 20:35
var g,h,i,j,l,m,n:integer;
    k:int64;
    sg,si:byte;
    s:string;

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

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

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