原题目:
http://bestcoder.hdu.edu.cn/contests/contest_showproblem.php?cid=584&pid=1003
#include<stdio.h>
#include<set>
#define M 1000+10
using namespace std;
int A[M],B[M],C[M],D[M];
int a[M],b[M],c[M],d[M];
//int S[M];
double sum;
int main()
{
int k,m,n,t,i,j;
int l=0;
set<double> s;
scanf("%d",&t);
while(t--)
{
scanf("%d%d",&n,&m);
for(i=0;i<n;i++)
scanf("%d.%d.%d.%d",&A[i],&B[i],&C[i],&D[i]);
for(i=0;i<m;i++)
scanf("%d.%d.%d.%d",&a[i],&b[i],&c[i],&d[i]);
l++;
printf("Case #%d:\n",l);
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
sum = (A[j]&a[i])*1000000+(B[j]&b[i])*1000+(C[j]&c[i])+(D[j]&d[i])*0.001;
s.insert(sum);
}
printf("%d\n",s.size());
s.clear();
}
}
return 0;
}