Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- int main()
- {
- int N,PA[100000], x, base, count=1;
- scanf("%d", &N);
- for(x=0; x<N; x++) {
- scanf("%d", &PA[x]); }
- for(x=2; x<N; x++) {
- base = PA[x-1] - PA[x-2];
- if(PA[x] - PA[x-1] != base) {
- count++; x=x+1; }
- }
- printf("%d", count);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement