解题思路:
注意事项:
参考代码:
#include<stdio.h>
#include<stdlib.h>
int main()
{
int n, * a,i,plateau_length=1,max_plateau_length=0;
scanf("%d", &n);
a = (int*)malloc(n * sizeof(int));
for (i = 0; i < n; i++)
scanf("%d", &a[i]);
i = 0;
while (i<n-1)
{
plateau_length = 1;
while (a[i] == a[i + 1])
{
plateau_length++;
i++;
}
if (max_plateau_length < plateau_length)
{
max_plateau_length = plateau_length;
}
i++;
}
printf("%d", max_plateau_length);
return 0;
}
0.0分
0 人评分
【计算两点间的距离】 (C语言代码)浏览:884 |
哥德巴赫曾猜测 (C语言代码)浏览:1019 |
C语言训练-数字母 (C语言代码)浏览:649 |
简单的for循环浏览:1410 |
C语言程序设计教程(第三版)课后习题7.2 (C语言代码)浏览:798 |
【明明的随机数】 (C语言代码)浏览:787 |
C语言程序设计教程(第三版)课后习题8.8 (C语言代码)浏览:546 |
C语言程序设计教程(第三版)课后习题10.1 (C语言代码)浏览:567 |
蚂蚁感冒 (C语言代码)浏览:1335 |
Hello, world! (C语言代码)浏览:714 |