摘要:
#include <stdio.h>#include <stdlib.h>#define N 10void main(){ int p,q; int i,j; int id[N]; for(int i=0;i<N;i++) id[i] = i; while(scanf("%d %d ",&p,&q)==2) { for(i=p;i!=id[i];i=id[i]); for(j=q;j!=id[j];j=id[j]); if(i == j) continue; id[i] = j; for(i=0;i<N;i++) prin 阅读全文