CCF CSP201509-1数列分段
#include<iostream>
using namespace std;
int main(){
int n, ans = 1, pre;
cin>>n;
for(int i = 0; i < n; i++){
int num;
cin>>num;
if(i == 0) pre = num;
if(pre!=num) ans++,pre = num;
}
cout<<ans<<endl;
return 0;
}
2023-08-11 18:34:34