delete pics to save space

This commit is contained in:
2023-08-03 09:22:52 +08:00
commit de60cd6ed4
1334 changed files with 66221 additions and 0 deletions

28
2.1160.cpp Normal file
View File

@ -0,0 +1,28 @@
#include<cstdio>
const int maxn=100010;
int x,y,fa[maxn];
int ff(int x)
{
return fa[x]!=x?fa[x]=ff(fa[x]):x;
}
int main()
{
#ifdef local
freopen("pro.in","r",stdin);
#endif
while(scanf("%d",&x)==1)
{
for(int i=0;i<maxn;i++) fa[i]=i;
int res=0;
while(x!=-1)
{
scanf("%d",&y);
x=ff(x);y=ff(y);
if(x==y) ++res;
else fa[x]=y;
scanf("%d",&x);
}
printf("%d\n",res);
}
return 0;
}