一个循环
This commit is contained in:
parent
9f58fef2ce
commit
a81b127c24
25
RRRun/xh.md
Normal file
25
RRRun/xh.md
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
int main()
|
||||||
|
{
|
||||||
|
int n,s=1,max=1;
|
||||||
|
scanf("%d",&n);
|
||||||
|
int a[10000];
|
||||||
|
for(int i=0;i<n;i++)
|
||||||
|
{
|
||||||
|
scanf("%d",&a[i]);
|
||||||
|
|
||||||
|
if(a[i]==a[i-1]+1)
|
||||||
|
{
|
||||||
|
s=s+1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
s=1;
|
||||||
|
}
|
||||||
|
if(max<s)
|
||||||
|
{
|
||||||
|
max=s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf("%d",max);
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user