0!!

P1567 统计天数

max命名与函数名重复
by Textbook_blasphemy @ 2021-02-23 08:27:33


头像危
by Textbook_blasphemy @ 2021-02-23 08:30:04


`long long a[n+3];` 好像不能这样用罢
by FCB_1899 @ 2021-02-23 08:31:10


@[liuxingjian](/user/209561) 可以
by Ryo_Yamada @ 2021-02-23 08:38:08


改对了,自己理解一下 ```cpp #include<iostream> #include<algorithm> using namespace std; long long a[1000005]; int main(){ long long n,cnt=1,mx=0; cin>>n; cin>>a[0]; for(int i=1;i<n;i++){ cin>>a[i]; if(a[i]>a[i-1]){ cnt++; } else{ mx=max(cnt,mx); cnt = 1; } } mx = max(mx, cnt); cout<<mx; return 0; } ```
by Ryo_Yamada @ 2021-02-23 08:40:47


@[吴昱胤](/user/385165)
by Ryo_Yamada @ 2021-02-23 08:40:54


@[BreezeEnder](/user/242543) 可以吗?不是数组定义不能用变量吗?
by Textbook_blasphemy @ 2021-02-23 08:41:27


@[陶(戴)佳伟](/user/328443) 可以啊。。。
by Ryo_Yamada @ 2021-02-23 08:41:38


@[陶(戴)佳伟](/user/328443) 这个头像又不是不可以……
by Eason_AC @ 2021-02-23 08:44:35


@[BreezeEnder](/user/242543) 数组不能用变量定义空间吧,因为程序生成exe文件要声明最多用多少空间,要是用变量定义的话,只能在输入时定义,反正会有问题(我们社团老师说的,C++标准不让这么用,要养成好的习惯)
by 王熙文 @ 2021-02-23 09:01:57


| 下一页