CSP-201509-1-数列分段 解题代码 #include <iostream> #include <vector> #include <algorithm> using namespace std; int n; int main() { cin >> n; vector<int>arr(n); for(auto & it:arr) { cin >> it; } auto last = unique(arr.begin(), arr.end()); arr.erase(last, arr.end()); cout << arr.size(); return 0; }