level 1
XiphoidXeric
楼主
据说是要加利用sqrt(N)的优化的,否则容易超时,现在已经加了为什么依然超时~vara:array[1..100] of integer;i,j:integer;begina[1]:=0;for i:=2 to 100 do a[i]:=i;for i:=2 to trunc(sqrt(100)) dobeginif a[i]<>0 thenbeginj:=2*i;while a[j]<=100 dobegina[j]:=0;j:=j+i;end;end;end;for i:=1 to 100 doif a[i]<>0 then write(a[i]:5);end.请不要重写程序,只是适当修改~
2008年05月04日 08点05分
1