问题描述
1 #include <iostream> 2 using namespace std; 3 int main() 4 { 5 int n, a[1000],count=1; 6 cin >> n; 7 cin >> a[0]; 8 for (int i = 1; i < n; i++) { 9 cin >> a[i]; 10 if (a[i] != a[i - 1])count++; 11 } 12 cout << count; 13 return 0; 14 }
原文:https://www.cnblogs.com/cqy1245053939/p/10137021.html