1963. Max Integer
Description
Given a set of n integers: A = {a1, a2,..., an}, calculate the max integer in the set.
Input
The first line is an integer n (1<=n<=5000). The second line contains n integers: a1, a2, ..., an. (|ai| <= 10000).
Output
The max integer in the set.
Sample Input
5 5 0 3 -5 7
Sample Output
7
// source code of submission 964221, Zhongshan University Online Judge System
#include <iostream>
using namespace std;
int main()
{
int n,a[10000];
cin >> n;
for ( int i = 0;i < n; i++)
cin >> a[i];
int max = a[0];
for(int i = 1;i < n;i++)
{
if(a[i] >= max)
max = a[i];
}
cout << max << endl;
return 0;
}