Home > Back-end >  CCF display operation error
CCF display operation error

Time:10-28

The 2014-9-1 consecutive Numbers on the topic
Problem description
Given n different integer, asked how many of these Numbers to integers, their values are 1,
Input format
The first line of the input contains an integer n, according to a given integer number,
The second line contains n integers, given by the
The output format
Output an integer, said the count of the number of values are 1,
The sample input
6
10 2 June 3 July 8
Sample output
3
The sample description
The number of values are 1 to include (2, 3), (6, 7), (7, 8),
Review case size and agreed
1<=n<=1000, for a given integer less than 10000 of nonnegative integers,
This is topic request
 

#include
# include & lt; Stdlib. H>
Int main () {
Int n, I, data=https://bbs.csdn.net/topics/0, j, * a, * p * q;
A=(int *) malloc (n * sizeof (int));
The scanf (" % d/n ", & amp; n);
P=a;
Q=p + 1;
for(i=0; i
The scanf (" % d ", & amp; A [I]);
}

for(i=0; ifor(j=1; jIf (* * p - q==1 | | * * p - q==1) {
Data++;
break;
}
Q++;
}
P++;
Q=p + 1;
}
Printf (" % d ", data);
return 0;
}
My code is such, run results no problem, according to operation error, why
  • Related