D025: select the maximum number from N.

Source: Internet
Author: User

D025: select the maximum number from N.

Content:

Select the maximum number from N.

Input description:

Two rows

Number N of the first row, indicating the total number

The second line contains N numbers separated by spaces.

Output description:

One row, Max

Input example:

If the questions are not described in detail, read them in multiple groups of test data, or refer to a001.
41 2 3 4

 

Output example:

4

Tip:

 

Source:

(Administrator: Problem) answer: # Include <iostream> <br/> using namespace STD; <br/> int main () <br/> {<br/> int A [1000], n, I, t; <br/> CIN> N; <br/> for (I = 0; I <n; I ++) <br/> {CIN> A [I] ;}< br/> for (I = 0; I <n-1; I ++) <br/>{< br/> if (a [I]> A [I + 1]) <br/> {<br/> T = A [I + 1]; A [I + 1] = A [I]; A [I] = T; <br/>}</P> <p >}< br/> cout <A [n-1] <Endl; <br/> return 0; <br/>}

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.