|
|
back to boardwhy i got wrong answer? Posted by qwt 28 Apr 2002 19:30 var z,y,x,a,b,tt,i,j,k,p,q,r:longint; ss:array[1..10000] of longint; s:string; begin tt:=1;ss[1]:=2; for i:=3 to trunc(sqrt(1000000)) do begin for j:=1 to tt do if (i mod ss[j]=0)or(ss[j]>trunc(sqrt(i))) then break; if i mod ss[j]<>0 then begin inc(tt); ss[tt]:=i; end; end; readln(a,b); for y:=a to b do begin q:=1; x:=y; r:=1; k:=1; while (x<>1 )and(k<>tt) do begin for j:=k to tt do if x mod ss[j]=0 then break; k:=j; if x mod ss[j]=0 then begin z:=1; p:=1; while x mod ss[j]=0 do begin z:=z*ss[j]; p:=z+p; q:=q*ss[j]; x:=x div ss[j]; end; r:=r*p; if (r>=2*q) then break; end; end; if x<>1 then begin r:=r*(x+1);q:=y;end; if r<2*q then begin
writeln(y); halt; end; end; end. |
|
|