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 1014. Product of Digits

Why Wrong Answer???
Posted by Voland 17 Dec 2002 16:12
here is code:
program Voland_1014;

var
    N, i: longint;
    s, stmp: string;
    d: boolean;
begin
    readln (N); s:='';
        if N < 2 then begin writeln (N); exit; end;
    repeat
        d:=false;
        for i:=9 downto 2 do begin
            if N mod i = 0 then begin
                d:=true;
                N := n div i;
                str (i, stmp);
                s:= stmp + s;
                break;
            end;
        end;
        if not d then begin
            writeln (-1);
            exit;
        end;
    until N=1;
    writeln (s);
end.
Re: Why Wrong Answer???
Posted by geniushjs 5 Aug 2003 13:12
> here is code:
> program Voland_1014;
>
> var
>     N, i: longint;
>     s, stmp: string;
>     d: boolean;
> begin
>     readln (N); s:='';
>         if N < 2 then begin writeln (N); exit; end;
>     repeat
>         d:=false;
>         for i:=9 downto 2 do begin
>             if N mod i = 0 then begin
>                 d:=true;
>                 N := n div i;
>                 str (i, stmp);
>                 s:= stmp + s;
>                 break;
>             end;
>         end;
>         if not d then begin
>             writeln (-1);
>             exit;
>         end;
>     until N=1;
>     writeln (s);
> end.