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!!!

Help, what is wrong in my programm??
Posted by Koryakov Anton_ghost_Anigus 5 Nov 2005 15:05
program factorials_1083_COD;

{$APPTYPE CONSOLE}

var n:integer;
    ks:string;
    k,j:integer;
    pr:longword;
    mark:boolean;
begin
readln(n,ks);
k:=length(ks)-1;
pr:=1;
j:=1;
pr:=n;
if n mod k=0 then
 begin
 while mark=false do
 if (n-j*k)>0 then
  begin
  pr:=pr*(n-j*k);
  j:=j+1;
  end
 else mark:=true;
 pr:=pr*k
 end;

if n mod k<>0 then
 begin
 while mark=false do
 if (n-j*k)>0 then
  begin
  pr:=pr*(n-j*k);
  j:=j+1;
  end
 else mark:=true;
 pr:=pr*(n mod k);
 end;

writeln(pr);
end.

ive got wa on 5 test

Edited by author 05.11.2005 15:07

Edited by author 05.11.2005 15:07