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 ME PLEASE!
Posted by KOTMAKRUS 13 Nov 2013 16:51
I have 1 test runs but on the server WA test 1!!???

program pro;
var n,k,t:byte; s:string; sum:integer;
BEGIN
read(n,s); t:=1; k:=length(s)-1;
      if n mod k=0 then begin
                        sum:=n;
                        while n-t*k>0 do begin
                                         sum:=sum*(n-t*k); t:=t+1;
                                         if sum*(n-t*k)<0 then break;
                                         end;
                        sum:=sum*k;
                        end else
                        begin
                        sum:=n;
                        while n-t*k>0 do begin
                                         sum:=sum*(n-t*k); t:=t+1;
                                         if sum*(n-t*k)<0 then break;
                                         end;
                        sum:=sum*(n mod k);
                        end;
write(sum);
END.

9 !! My program write 945 and why WA 1??????