Nyoj-abnormal maximum value
Abnormal maximum time limit: 1000 MS | memory limit: 65535 KB difficulty: 1
-
Description
-
During the Yougth lecture, I tried to find the maximum number of three items. I didn't expect everyone to master this problem. Fortunately, with his help, everyone solved this problem, but the problem came again.
He wants to find a number in a group. This number may not be the largest in this group, but if it is relatively large, but there are too many to meet this condition, what should he do? He thought of a way to divide the numbers of each adjacent group into a group from the beginning (the number of groups starts from 1), calculate the maximum value of the odd array, and the minimum value of the even group, find the maximum value among these values.
-
Input
-
There are multiple groups of test data, marked by the file Terminator.
Each group of test data is first N, which is the number of arrays. (0 And then the numbers in the array.
-
Output
-
The output contains one row, that is, the maximum value.
-
Sample Input
-
34 5 661 2 3 7 9 5
-
Sample output
-
65
-
Source
Yougth original
#include
#include
#includeusing namespace std;int main(){int n,a[4000];while(~scanf("%d",&n)){memset(a,0,sizeof(a));int i,j=0,k=0,x,y,z;for(i=0,k=1;i