请问各位哪里可以简化一下?

P1567 统计天数

不对!是全错哎!
by 顶天不立地 @ 2021-07-23 18:44:02


```cpp #include<bits/stdc++.h> using namespace std; int main() { long long n,C[10000000],max=0,maxn=0; cin>>n; for(int i=1;i<n;i++) { cin>>C[i]; if(C[i]>C[i-1]) max++; else if(max>maxn) { maxn=max; max=0; } else max=0; } cout<<maxn+1; return 0; } ``` ~~代码一份。拿走不送~~
by juruolht @ 2021-07-23 18:45:20


(卡int了)
by juruolht @ 2021-07-23 18:46:14


@[250lht](/user/308386) 谢谢谢谢
by 顶天不立地 @ 2021-07-23 18:47:08


@[250lht](/user/308386) 依旧的大红大紫
by 顶天不立地 @ 2021-07-23 18:47:50


?记录给我康康
by juruolht @ 2021-07-23 18:48:56


@[250lht](/user/308386) 怎样弄图片(地址怎么填)
by 顶天不立地 @ 2021-07-23 18:51:40


else cnt应该赋值1吧
by memory_frv @ 2021-07-23 19:04:18


```cpp #include<bits/stdc++.h> using namespace std; int n,a[1000005],cnt=1,maxn=-1e9; int main(){ cin>>n; for(int i=1;i<=n;i++) cin>>a[i]; for(int i=1;i<=n;i++){ if(a[i]<a[i+1]) cnt++; else cnt=0; // ^^^^^cnt=1 maxn=max(cnt,maxn); } cout<<maxn; return 0; } ```
by EthanC_ @ 2021-07-23 19:08:01


@[_Ethan123_](/user/517086) 试过了,还是爆红
by 顶天不立地 @ 2021-07-27 09:35:05


| 下一页