|
|
вернуться в форумWhy Time limit Exided Послано misha 23 окт 2002 11:07 program zzz; var n,l,i,j,k : longint; q : real; s : string; a : array [1..100000] of byte; begin read(n); k := 0; if n = 0 then begin write(0); halt; end; while true do begin for i := 9 downto 2 do begin if n mod i = 0 then begin k := k+1; a[k] := i; n := n div i; break; end; end; if (n < 10) then begin if n > 1 then begin k := k+1; a[k] := n; end; break; end; if i = 2 then begin write(-1); halt; end; end; for i := 1 to k-1 do begin for j:= i+1 to k do begin if a[i]>a[j] then begin l := a[i]; a[i] := a[j]; a[j] := l; end; end; end; if k = 0 then write(1); for i := 1 to k do begin write(a[i]); end; end. Re: Why Time limit Exided Послано Oleg 24 окт 2002 14:45 > program zzz; > var n,l,i,j,k : longint; > q : real; > s : string; > a : array [1..100000] of byte; > begin > read(n); > k := 0; > if n = 0 then begin > write(0); > halt; > end; > while true do begin > for i := 9 downto 2 do begin > if n mod i = 0 then begin > k := k+1; > a[k] := i; > n := n div i; > break; > end; > end; > if (n < 10) then begin > if n > 1 then begin > k := k+1; > a[k] := n; > end; > break; > end; > if i = 2 then begin > write(-1); > halt; > end; > end; > for i := 1 to k-1 do begin > for j:= i+1 to k do begin > if a[i]>a[j] then begin > l := a[i]; > a[i] := a[j]; > a[j] := l; > end; > end; > end; > if k = 0 then write(1); > for i := 1 to k do begin > write(a[i]); > end; > end. LHLHLHLHLHLHLHLHLHLHLHLHLHLHLHLHLHLHLHLHLHLHLHLHLHLHLHLH |
|
|