bool那东西多打了没用请忽略()()
by 77Glorious @ 2023-11-24 21:37:47
`if(a[i]>a[i-1]) cnt++;`这里也要存一下b[i]=cnt;
否则`1 2 3 4 5`这种数据是不会被统计的
by Hatsune_Miku_ @ 2023-11-24 21:42:14
这是我的代码,你可以参考一下(一遍过)
```cpp
//#include<bits/stdc++.h>万能头文件
//STL
#include <algorithm> //STL 通用算法
#include <bitset> //STL 位集容器
#include <deque> //STL 双端队列容器
#include <functional> //STL 定义运算函数(代替运算符)
#include <queue> //STL 队列容器
#include <set> //STL 集合容器
#include <utility> //STL 通用模板类
#include <vector> //STL 动态数组容器
#include <stack> //STL 堆栈容器
#include <list> //STL 线性列表容器
#include <map> //STL 映射容器
//其他
//#include <windows.h>
//#include <time.h>
//#include <cctype>
//#include <cerrno>
//#include <clocale>
//#include <cmath>//数学函数
//#include <complex> //复数类
//#include <cstdlib>
//#include <cstring>//字符串函数
//#include <ctime>
//#include <exception> //异常处理类
//#include <fstream>
//#include <limits>
//#include <iomanip>
//#include <ios> //基本输入/输出支持
//#include <iosfwd> //输入/输出系统使用的前置声明
//#include <istream> //基本输入流
//#include <ostream> //基本输出流
//#include <sstream> //基于字符串的流
//#include <stdexcept> //标准异常类
//#include <streambuf> //底层输入/输出支持
//#include <string> //字符串类
//#include <cwchar>
//#include <cwctype>
//#include <stdio.h>
//#include <cstdio>
#include <iostream>
#define fo(i,j,n,k) for(int (i)=(j);(i)<=(n);(i)+=(k))
using namespace std;
const int upint=1e6+10;
const double downdouble=1e-6;
int n,s[1000010],a[1000010],maxn=0;
int main(){
//freopen(".in","r",stdin);
//freopen(".out","w",stdout);
cin>>n;
fo(i,1,n,1){
cin>>a[i];
s[i]++;
if(a[i]>a[i-1]) s[i]+=s[i-1];
maxn=max(maxn,s[i]);
}
cout<<maxn;
return 0;
}
```
by danlao @ 2023-11-24 21:45:34
连续的数据如1,2,3,4,没被统计,导致没输出
by Zhengjunye080120 @ 2023-11-24 21:45:52
我的代码有点类似连续字段和
by danlao @ 2023-11-24 21:47:20