当前位置:网站首页>CCF sequence segmentation (Full Score code + problem solving idea) 201509 -1
CCF sequence segmentation (Full Score code + problem solving idea) 201509 -1
2022-06-30 14:41:00 【A cute little monkey】
Title Description

Their thinking
When in an array The current number is different from the previous one , Add one to the number of paragraphs , So when you enter an array , Accumulated number of segments according to special judgment
Code implementation
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 1010;
int a[N];
int main()
{
int n;
cin >> n;
int res = 1;
for (int i = 0; i < n; i ++)
{
cin >> a[i];
if (i && a[i] != a[i - 1]) res ++; // When the number is not a[0] And the number is not equal to the previous number , Add one to the number of paragraphs
}
cout << res;
return 0;
}
边栏推荐
- Summary of FTP network protocol learning
- Data recovery software easyrecovery15 Download
- PHP recursive multi-level classification, infinite classification
- Not satisfied with markdown native code block style? Try this beautify code screenshot tool~~
- V3 02——What‘s new in Chrome extensions
- The JSON data returned from the control layer to JS has a "\" translator. How to remove it
- 从控制层返回到js的json数据带“\”转译符,怎么去掉
- Vue returns to the previous page without refreshing the page / Vue caches the page
- The first three passes of sqli Labs
- DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703
猜你喜欢

go time. after

2021-07-14 mybaitsplus

remote: Support for password authentication was removed on August 13, 2021. Please use a personal ac

How does hbuilder display in columns?

JS to realize simple lottery function

PS cutting height 1px, Y-axis tiling background image problem

About the problems encountered when using the timer class to stop with a button (why does the QPushButton (for the first time) need to be clicked twice to respond?)

I love network security for new recruitment assessment

Error $(...) size is not a function

go channel && select
随机推荐
@ResponseBody的作用
[extensive reading of papers] sentimental analysis of online reviews with a hierarchical attention network
Why is the resolution of the image generated by PHP GD library 96? How to change it to 72
C language & the difference between the address pointed to and the address pointed to by the pointer
@Component use cases
Uniapp upload image method
2021-08-05 leetcode notes
@component使用案例
Larave8 JWT API expiration custom error return
Invalid argument during startup: Failed to open the . conf file: redis-window
Clear the route cache in Vue
【BUUCTF】 Have Fun
Data recovery software easyrecovery15 Download
jsPlumb. Deleteeveryconnection is not a function & jsplumb clear canvas jsplumb delete all nodes and all connections
2021-08-07 native and package types
[extensive reading of papers] multimodal joint attribute prediction and value extraction for e-commerce product
PHP reverses scenarios based on code and skillfully uses debug_ backtrace()
[buuctf] [geek challenge 2019] secret file
2021-05-12
Wechat applet realizes map navigation + door-to-door recycling