摘要:
〖程序清单〗初始化:for i:=1 to n do father[i]:=i;因为每个元素属于单独的一个集合,所以每个元素以自己作为根结点。寻找根结点编号并压缩路径:function getfather(v : integer) : integer;beginif father[v]=v then... 阅读全文
摘要:
var tot,i,j,k,m,n:longint; prime:array[0..100000] of boolean; p:array[0..100000] of longint;begin read(n); fillchar(prime,sizeof(prime),true); p... 阅读全文