CCF认证真题-(201403-1)-相反数

 1 #include <iostream>
 2 #include <algorithm>
 3 #include <set>
 4 using namespace std;
 5 
 6 int main()
 7 {
 8     ios::sync_with_stdio(false);
 9     cin.tie(0);
10     int n;
11     cin >> n;
12     set<int> s;
13     for (int i = 0; i < n; i++) {
14         int x;
15         cin >> x;
16         s.insert(x < 0 ? -x : x);
17     }
18     cout << n - s.size() << endl;
19     return 0;
20 }

 

posted @ 2019-07-10 00:51  域Anton  阅读(153)  评论(0编辑  收藏  举报