Advertisement
rdsedmundo

[OBI] consecutivos.c

May 30th, 2013
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.44 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. #define Maior(a,b) (a>b)?a:b
  4.  
  5. int main() {
  6.     int Size, i, j, Count=1, Result=1;
  7.  
  8.     scanf("%d", &Size);
  9.  
  10.     int Num[Size];
  11.  
  12.     for(i = 0; i < Size; i++) scanf("%d", &Num[i]);
  13.  
  14.     for(i = 0; i < Size; i++) {
  15.         if(Num[i] == Num[i+1]) Count++;
  16.         else {
  17.                 Result = Maior(Count, Result);
  18.                 Count = 1;
  19.         }
  20.     }
  21.  
  22.     printf("%d", Result);
  23.  
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement