
CCF
MuMuLee_
加油
展开
-
二十次csp第二题把我难住的地方
输入01字符串,统计最多的连续的1有几个stage1.考试中对于0 0 1 1 1 0 0 1 1 1 1 0 1 1 1 1 1这样的串,考虑先统计每组1的个数(3/4/5)放进数组,排序得最大个数(5)----没做出来stage2.考完不必把所有个数放进数组,每统计出一个个数只跟最大值比较即可,有如下代码//输入01字符串,统计最多的连续的1有几个#include <iostream>using namespace std;int main(){ int a[10原创 2020-09-21 10:20:09 · 326 阅读 · 0 评论 -
C++/count函数
count是个函数 ,不能用作用户标识符//count函数的用法#include <iostream>#include<vector>#include<algorithm>//count函数using namespace std;int main(){ //数组计数 int a[10] = { 1, 2, 3, 4, 4, 4, 4 };//长度为10的数组,没初始化的为0 cout << count(a, a + 10, 0) <原创 2020-09-17 09:58:22 · 1721 阅读 · 0 评论