2018-计算机系机试(第二批)-A-最大数

时间:2023-03-08 23:32:48
2018-计算机系机试(第二批)-A-最大数

单点时限: 1.0 sec

内存限制: 256 MB

输入 n 个整数,输出其中最大数的值。

例如:3 个整数 1 ,2 和 6 的最大值是 6 。

输入格式

每一行的第一个数是 n (1≤n≤20 ),后面是 n 个整数(值范围为 −109 到 109 )。n+1 个整数之间都有一个空格。

输出格式

在每一行中最大值。

样例

Input
3 1 2 6
Output
6
Input
4 1 1 1 1
Output
1
Input
4 -1 5 10 10
Output
10
 #include<stdio.h>
int main()
{
int n;
int a;
int m;
while(scanf("%d",&n)!=EOF)
{
scanf("%d",&m);
for(int i=;i<n;i++)
{
scanf("%d",&a);
if(a>m)
m=a;
}
printf("%d\n",m);
}
return ; }