Advertisement
Raul_julian

Consecutivo-[OBI]

Jun 17th, 2013
344
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.40 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     int N, x, vetor[10000], ca=1, y=0, result=0;
  6.  
  7.     scanf("%d", &N);
  8.    
  9.             if(N<1 || N>10000) return 0;
  10.    
  11.         for(x=0; x<N; x++) {
  12.    
  13.         scanf("%d", &vetor[x]);
  14.                         }
  15.    
  16.         for(x=0; x<N; x++) {
  17.            
  18.             y++;
  19.             if(vetor[x] == vetor[y]) { ca++;}
  20.                 else if(ca>result) {result=ca; ca=1;}
  21.             else ca=1;  
  22.     }
  23.  
  24.     printf("%d", result);
  25.    
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement