|
|
back to boardTLE#12 What is this test? I do not understand! Show me super-tests! Thanks This is my code: {$I-,Q-,R-,S-} VAR n,i,p,r :longint; a :array[0..30]of byte; Procedure INIT; begin readln(n); end; Procedure OUT; begin writeln('Impossible'); end; Function OK:boolean; var i,j,ost :longint; begin i:=1; ost:=0; while i<=a[0] do begin j:=i; while(ost<n)and(j<=a[0]) do begin ost:=ost*10+a[j]; inc(j); end; i:=j; ost:=ost mod n; end; OK:=FALSE; if ost=0 then OK:=TRUE; end; Procedure REC(r,p,pp:byte); var i :byte; begin a[p]:=r; a[0]:=p; if p>pp then exit; if OK then begin for i:=1 to a[0]-1 do write(a[i]); writeln(a[a[0]]); halt; end; REC(1,p+1,pp); REC(2,p+1,pp); end; BEGIN INIT; if n mod 5<>0 then begin r:=n; p:=0; while r<>0 do begin inc(p); r:=r div 10; end; for i:=p to 30 do begin REC(1,1,i); REC(2,1,i); end; end else OUT; END. Edited by author 27.01.2007 00:49 Re: TLE#12 Posted by valdem 28 Feb 2007 23:33 I think in this test n mod 10989=0 , and answer have 28-30 signs |
|
|