当前位置:网站首页>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;
}
边栏推荐
- Pit used by go language array type
- Searching for single element in dichotomy
- Computer screenshot how to cut the mouse in
- Upgrade centos7 mysql5.5 to mysql5.7 non RPM in the form of tar package
- Error $(...) size is not a function
- Summary of FTP network protocol learning
- Three ways and differences of defining functions in JS
- Double pointer letter matching
- Add attributes to multimode
- Vue returns to the previous page without refreshing the page / Vue caches the page
猜你喜欢

2021-07-14 mybaitsplus
![[buuctf] [geek challenge 2019] secret file](/img/00/23bebd013eb4035555c0057725e3c4.jpg)
[buuctf] [geek challenge 2019] secret file

ThinkPHP show method parameter controllable command execution

ctfshow nodejs

KnightCTF WEB

Using docker to manage MySQL services under Windows

Go language mutex lock

Problems in QT creator (additional unknown and error lines are listed in the debug output window)

Summary of use of laravel DCAT admin

Error on datetime when importing SQL file from MySQL
随机推荐
Use PHP to delete the specified text content in the file
jsPlumb. Deleteeveryconnection is not a function & jsplumb clear canvas jsplumb delete all nodes and all connections
In situ merging of two arrays with two pointers
Vue returns to the previous page without refreshing the page / Vue caches the page
PHP common authentication / third-party methods
MySQL back to table query optimization
Laravel configures passport and returns token using JWT
2021-07-15Caused by: org. quartz. ObjectAlreadyExistsException: Unable to store Job : ‘DEFAULT. TASK_ 1‘
PS tip: the video frame to Layer command cannot be completed because dynamiclink is not available
go time. after
PHP recursive multi-level classification, infinite classification
PS dynamic drawing
[buuctf] [geek challenge 2019] secret file
V3_ Chrome extended Chinese translation document V3 directory
2021-08-07 native and package types
C language & the difference between the address pointed to and the address pointed to by the pointer
Attack and defense world web questions
Detailed explanation of the first three passes of upload Labs
Larave8 JWT API expiration custom error return
Finding the root of an integer by dichotomy