|
|
вернуться в форумHow could somebody get AC in 0.01 sec !!! How could somebody get AC in 0.01 sec !!! and uses mem lower than 50K plz. show your algorithm 0.01 and 24KB (+) Послано Pasha 22 апр 2003 16:28 it is a part of my Ac prog... I`ve cut others and also did a little changes to avoid letting someone Copy It: Aidin_n7@hotmail.com ~~~~~~~~~~~~~~~~~ for i:=b downto a do begin p:=1; for j:=2 to trunc(sqrt(i)) do if (i mod j)=0 then begin p:=p+j+(i div j); if sqr(trunc(sqrt(i)))=i then p:=p-trunc(sqrt(i)); if p>i*m then begin p:=-1; break; end; end; if p=1 then begin writeln(i); readln; halt; end else if (p>0) and (p/i<m) then begin m:=p/i; ans:=i; end; ~~~~~~~~~~~~~~~~~ Best Aidin Re: 0.01 and 24KB (+) Don't worry. I got AC before I want to know the best solution. Thank you for your help. |
|
|