当前位置:网站首页>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;
}
边栏推荐
- 2021-05-12
- Att & CK red team evaluation field (I)
- [extensive reading of papers] multi modal sarcasm detection and human classification in code mixed conversations
- JS delete the objects in the array and specify to delete the objects
- NoViableAltException([email protected][])
- 【BUUCTF】 Have Fun
- Detailed explanation of the first three passes of upload Labs
- ThinkPHP show method parameter controllable command execution
- Race of golang
- The JSON data returned from the control layer to JS has a "\" translator. How to remove it
猜你喜欢
The first dark spring cup dnuictf
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?)
MySQL back to table query optimization
Why does the folder appear open in another program
LIS error: this configuration section cannot be used in this path
Go language mutex lock
XSS challenge (6-10) more detailed answers
PS tip: the video frame to Layer command cannot be completed because dynamiclink is not available
[buuctf] [actf2020 freshman competition]include
@PathVariable
随机推荐
PHP reverses scenarios based on code and skillfully uses debug_ backtrace()
Not satisfied with markdown native code block style? Try this beautify code screenshot tool~~
[extensive reading of papers] sentimental analysis of online reviews with a hierarchical attention network
Upgrade composer self update
Effect of shadow around the block after mouse over
V3_ Chrome extended Chinese translation document V3 directory
Race of golang
The difference between settimeout() and setinterval()
Learn about data kinship JSON format design from sqlflow JSON format
PHP excel export function encapsulation (based on phpexcel class)
Binary rotation array (1)
从控制层返回到js的json数据带“\”转译符,怎么去掉
val_ Loss decreases first and then increases or does not decrease but only increases
How to realize selective screen recording for EV screen recording
remote: Support for password authentication was removed on August 13, 2021. Please use a personal ac
[geek challenge 2019] PHP problem solving record
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?)
Detailed explanation of the first three passes of upload Labs
[extensive reading of papers] multimodal joint attribute prediction and value extraction for e-commerce product
ThinkPHP show method parameter controllable command execution