1 #include <iostream> 2 #include <vector> 3 #include <algorithm> 4 5 int main() { 6 int x{},sum{}; 7 std::cin >> x; 8 std::vector<int> n(x, 0); 9 for (int i{}; i < x; i++) { 10 std::cin >> n[i]; 11 if (n[i] < 0) n[i] = -n[i]; 12 } 13 std::sort(std::begin(n), std::end(n)); 14 for (int i{}; i < x; i++) { 15 if (n[i] == n[i + 1]) { 16 sum++; 17 i++; 18 } 19 } 20 std::cout << sum; 21 }
标签:201403,std,int,++,include,相反数,CSP From: https://www.cnblogs.com/n00b/p/16895177.html