Advertisement
Raul_julian

Progressões-[OBI]

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