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

it2022-05-05  140

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 }

 

转载于:https://www.cnblogs.com/AntonLiu/p/11161433.html


最新回复(0)