|
|
back to boardHow could somebody get AC in 0.01 sec !!! Posted by vongman 22 Apr 2003 14:51 How could somebody get AC in 0.01 sec !!! and uses mem lower than 50K plz. show your algorithm 0.01 and 24KB (+) Posted by Pasha 22 Apr 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 (+) Posted by vongman 23 Apr 2003 10:38 Don't worry. I got AC before I want to know the best solution. Thank you for your help. |
|
|