Nyoj-abnormal maximum value

Source: Internet
Author: User

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
       
        

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.