下标计数
上代码!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#include<bits/stdc++.h>
using namespace std;
int n,x,a[105],ans,maxx=INT_MIN;
int main()
{
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>x;
a[x]++;
maxx=max(maxx,x);
}
for(int i=1;i<=maxx;i++) ans+=a[i]/2;
cout<<ans/2;
return 0;
}
欢迎参考