#include
main()
{
int i,men,num=1,len=1,sum=1;
int x[]={1,2,3,3,4,4,5,5,5,6};
for(i=1;i<10;i++){
if(x[i]==x[i-1]){
sum=sum+1;
}
else{
num=num+1;
if(len
}
}
}
printf("%d",num);//平台的个数
printf("\n");
printf("%d",len);//最长平台的长度
printf("\n");
printf("%d",men);//构成最长平台的那个数组值
printf("\n");
}
#include
#include
#define max 20
int main(int argc, char *argv[])
{int N,arr[max];
int arr1[max][max]={0};
int k,j,i,count;
int m=0,max1=0;
printf("please input total number:");
scanf("%d",&N);
for(i=0;i
for(i=0;i
m++;
arr1[m-1][k]=arr[i];
for(j=i+1;j
else
{arr1[m-1][k++]=arr[j];i=j;}
}
for(i=0;i
for(j=0;arr1[j]!=0;j++)
count++;
if(max1
printf("the lengthest is:\n");
for(j=0;arr1[j]!=0;j++)
printf("%d",arr1[k][j]);
printf("%d",max1);
system("PAUSE");
return 0;
}
#include
int fun(int x[],int size)
{
int * p0,* p1,* pos;
p1=p0=x;
int max=0;
while(p1
if(* p1==* p0)
p1++;
else
{
if(p1-p0>max)
{
max=p1-p0;
pos=p0;
}
p0=p1;
}
}
for(p0=pos;p0
printf("\n");
return max;
}
void main()
{
int X[]={1,2,3,3,4,4,5,5,5,6};
printf("%d\n",fun(X,sizeof(X)/sizeof(int)));
}