British astronomer eddington likes to ride a bike, he is said to have in order to show off their cycling capability, also defines a number of "eddington" E, E day cycling more than satisfy is what is the largest integer E E miles, it is said that love d E is equal to 87,
Now given someone N days cycling distance, please work out the corresponding number of eddington E (N) or less,
Input format:
Enter the first line is given a positive integer N (10 or less
? 5
?? The number of days), namely the continuous cycling; The second line gives N nonnegative integer, representing a day cycling distance,
The output format:
Given N days in a row number of eddington,
Input the sample:
10
6, 7 and 9 3 10 8 2 7 8
The output sample:
6
CodePudding user response:
My understanding of the subject is the first and then the last day's ride is more than I can count the number of output meet the conditions; The following is a code# include & lt; stdio.h>
# include & lt; Algorithm>
using namespace std;
Int main () {
int n;
The scanf (" % d ", & amp; n);
Int a [n].
for(int i=0; IThe scanf (" % d ", & amp; A [I]);
}
Int count=0;
for(int i=0; IIf (a [I] & gt; (I + 1)) {
count++;
}
}
Printf (" % d ", count);
return 0;
}
CodePudding user response:
But the test point is fiveCodePudding user response:
Please bosses directions of search on the net is to sort of,,,, but I don't understand why must sortCodePudding user response:
I help you to change the code before you answer, you have a problem of the code itselfFirst line 7 cannot be written as
Int a [n]
This is certainly not,
According to your idea, write like this can,
Int * a=new int [n]
CodePudding user response:
Also, this algorithm is actually you have any question, you can try the number change position wrongCodePudding user response:
I now think not ordering you can't come to the conclusion, let me help you to think about it,