码迷,mamicode.com
首页 > 其他好文 > 详细

CCF认证真题-(201509-1)-数列分段

时间:2019-07-10 18:58:53      阅读:120      评论:0      收藏:0      [点我收藏+]

标签:mes   ace   color   bsp   for   als   ios   span   认证   

 1 #include <iostream>
 2 using namespace std;
 3 int main()
 4 {
 5     ios::sync_with_stdio(false);
 6     cin.tie(0);
 7     
 8     int n;
 9     cin >> n;
10     int pre;
11     cin >> pre;
12     int ans = 1;
13     for (int i = 1; i < n; i++) {
14         int x;
15         cin >> x;
16         if (x != pre) {
17             ans++;
18             pre = x;
19         }
20     }
21     cout << ans << endl;
22     return 0;
23 }

 

CCF认证真题-(201509-1)-数列分段

标签:mes   ace   color   bsp   for   als   ios   span   认证   

原文地址:https://www.cnblogs.com/AntonLiu/p/11165508.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!