摘要:
题意:给出n个塔和m堵墙,求出被围墙包围的区域有多少个。分析:并查集判断环的个数。View Code #include <cstdio>#include <cstring>int f[1001];int find(int x){ return f[x] == x?x:(f[x]=find(f[x]));}int main(){ int n, m; int i, j; int res = 0; while (scanf("%d %d",&n,&m)!=EOF) { res = 0; for (i=0; i<n; i++) ... 阅读全文