标签:out for new class col div turn http continue
T1 简单题
思路:
根据定义遍历模拟即可
#include<iostream> using namespace std; int main(){ int n; cin>>n; int *a = new int[n] ; for(int i=0;i<n;i++) cin>>a[i]; int cnt = 1,tmp = a[0]; for(int i = 1;i< n ;i++){ if(a[i] == tmp) continue; else { tmp=a[i]; cnt++; } } cout<<cnt<<endl; return 0; }
标签:out for new class col div turn http continue
原文地址:https://www.cnblogs.com/liuzhuan-xingyun/p/13053593.html