标签:
1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<cstdlib> 5 #include<algorithm> 6 using namespace std; 7 const int maxn=1007; 8 int num[maxn]; 9 int main() 10 { 11 // freopen("in.txt","r",stdin); 12 int n,a;int ans=0; 13 scanf("%d",&n); 14 memset(num,0,sizeof(num)); 15 for(int i=1;i<=n;i++) 16 { 17 scanf("%d",&a); 18 num[a+500]++; 19 } 20 for(int i=1;i<=500;i++) 21 { 22 ans+=min(num[i+500],num[500-i]); 23 } 24 printf("%d\n",ans); 25 return 0; 26 }
标签:
原文地址:http://www.cnblogs.com/codeyuan/p/4374619.html