@[van能的搞事德M](/space/show?uid=130155)
变量不要在主函数里定义,会出玄学锅;还有那个i,n
by 两年打铁 @ 2019-01-24 21:04:32
@[van能的搞事德M](/space/show?uid=130155)
帮您改了一下
```
#include<bits/stdc++.h>
using namespace std;
int a[1001000]; int b[1001000];
int cnt=1; int t; int n;
int main()
{
scanf("%d",&n);
for(int i=0;i<n;i++)
scanf("%d",&a[i]);
for(int i=1;i<n;i++)
{
if(a[i]>a[i-1])
{ cnt++;
b[i]=cnt;
}
else
{
cnt=1;
b[i]=cnt;
}
}
t=b[1];
for(int i=1;i<=n;i++)
if(t<b[i])
t=b[i];
printf("%d",t); return 0;
}
```
by 两年打铁 @ 2019-01-24 21:07:45
@[CSJ1](/space/show?uid=87026) 谢谢
by van能的搞事德M @ 2019-01-24 21:35:44
@[CSJ1](/space/show?uid=87026) 这样只有四十分唉ε=(´ο`*)))唉
by van能的搞事德M @ 2019-01-24 21:40:05
@[CSJ1](/space/show?uid=87026) 好啦ac了谢谢
by van能的搞事德M @ 2019-01-24 21:45:28
## #include<bits/stdc++.h>
using namespace std;
int a[100100];
int b[100100];
int cnt=1;
int t;
int n;
int main()
{
scanf("%d",&n);
for(int i=0;i<n;i++)
scanf("%d",&a[i]);
for(int i=0;i<n;i++)
{
if(a[i]>a[i-1])
{
cnt++;
b[i]=cnt;
}
else
{
cnt=1;
b[i]=cnt;
}
}
t=b[1];
for(int i=1;i<n;i++)
if(t<b[i])
t=b[i];
printf("%d",t);
return 0;
}请问这么改有什么毛病?麻烦了
by van能的搞事德M @ 2019-01-24 21:48:42
@[van能的搞事德M](/space/show?uid=130155)
可是我亲测是AC的呀
by 两年打铁 @ 2019-01-24 22:55:32
@[CSJ1](/space/show?uid=87026) 我说我改的这一个代码有些问题,能帮忙看看吗?
by van能的搞事德M @ 2019-01-24 22:59:33
@[van能的搞事德M](/space/show?uid=130155)
(我也不知道为什么我那样就对了很玄学
by 两年打铁 @ 2019-01-24 23:12:50
@[van能的搞事德M](/space/show?uid=130155)
嗷嗷嗷我知道了数组开太小了
by 两年打铁 @ 2019-01-24 23:14:23