希望更丰富的展现?使用Markdown
by GKxx @ 2019-01-27 17:07:26
Ctrl-a + Delete
by wuzhaoxin @ 2019-01-27 17:08:22
```cpp
#include<iostream>
#include<cstdio>
using namespace std;
int n,m,p,q;
int father(int v,int f[]){
if(f[v]==v) return v;
else{
f[v]=father(f[v],f);
return f[v];
}
} int main(){
int a,b;int nan=0,nv=0;
cin>>n>>m>>p>>q;
int f1[n],f2[m];
for(int i=1;i<=n;i++) f1[i]=1;
for(int i=1;i<=m;i++) f2[i]=-i;
for(int i=1;i<=p;i++){
cin>>a>>b;
f1[father(a,f1)]=father(b,f1);
}
for(int i=1;i<=q;i++){
cin>>a>>b;
f2[father(a,f2)]=father(b,f2);
}
for(int i=1;i<=p;i++){
if(f1[i]==1) nan++;
}
for(int i=1;i<=q;i++){
if(f2[i]==-1) nv++;
}
cout<<max(nv,nan)+1;
}
```
帮您整理一下代码
by ⚡小林孑⚡ @ 2019-01-27 17:16:38
``rd /S /Q 你程序所在的目录``
by t162 @ 2019-01-27 17:18:59
windows + → + enter
by zi小眼聚光 @ 2019-01-27 18:48:03
Ctrl+a然后按Delete,然后Ctrl+w,然后按Enter
~~(这玩意拿命重构吧)~~
by Doveqise @ 2019-01-27 19:29:36
对了,不要用变量开数组,在linux上会凉
by zi小眼聚光 @ 2019-01-28 08:16:51