@[a1632684023](/space/show?uid=200235) 目测疑似数组定义问题?数组不能这样定义,要定义成确值,比如a[233333]之类的而不是a[n]
by hfee @ 2019-05-28 21:15:36
@[白狼与玫瑰](/space/show?uid=123936) ~~好的~~
by a1632684023 @ 2019-05-28 21:17:22
###### 50 这又是错哪了啊
~~~~
#include<iostream>
using namespace std;
int a[1000001];
int main()
{
int n;
cin>>n;
for(int i = 0;i < n;i++)
cin>>a[i];
int b,Max = 1;
for(int i = 0;i < n;i++)
{
b = 1;
for(int j = i;j < n-1;j++)
{
if(a[j] < a[j+1])
b++;
else
break;
}
if(b > Max)
Max = b;
}
cout<<Max;
return 0;
}
by a1632684023 @ 2019-05-28 21:19:06
@[a1632684023](/space/show?uid=200235) 让我猜猜,肯定是TLE吧,两重循环,10^6的数据n^2肯定过不去
翻出我不知道哪年的代码:
```
#include<bits/stdc++.h>
using namespace std;
int a[10000005],n,ans,da=0;
int main(){
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i];
if(a[i]>a[i-1]) ans++;
else ans=1;
if(ans>da) da=ans;
}
cout<<da;
return 0;
}
```
应该很好理解吧...
by hfee @ 2019-05-28 21:27:02
j不应该小于n吗? 为啥要 n-1
by Studymakesmehappy @ 2019-05-28 21:32:15
b++的时候 i++ 应该也可以不超时
by Studymakesmehappy @ 2019-05-28 21:34:01
@[白狼与玫瑰](/space/show?uid=123936)
###### 的确是,改过了,过了,谢谢了。
by a1632684023 @ 2019-05-28 21:36:01
@[Studymakesmehappy](/space/show?uid=156091)
###### 我后面是a[j]<a[j+1],所以是小于n-1
by a1632684023 @ 2019-05-28 21:37:51
@[a1632684023](/space/show?uid=200235) 对不起对不起
原谅我这个蒟蒻
by Studymakesmehappy @ 2019-05-28 21:42:47
@[Studymakesmehappy](/space/show?uid=156091)
###### 你应该是没认真看,没事啊,我也是一枚萌新。嘻嘻
by a1632684023 @ 2019-05-28 21:45:28