|
|
вернуться в форумWhy Wrong Answer??? Послано Voland 17 дек 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??? > 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. |
|
|