游客 Signup | Login
中文 | En

2160 - 屌丝VS女神 前传

女神如此多娇,引无数屌丝尽折腰!数院新生中最耀眼的女神,偏偏不喜欢数学比她差的男生,无数的屌丝追求者都被她的难题给击退了,信院屌丝阿V自从在学三见到女神的第一眼便深陷其中不可自拔。没有例外,冷酷的女神对阿V提出了她的难题:给你n个数,你能在一天之内找出里面最大的数么?一大堆的数字看得阿V眼花缭乱,请你帮忙设计一个程序,找出这n个数中的最大值。

Input

首先输入一个整数n1<=n<=10^6),表示有n个数,每个数不大于10^11,下一行输入n个整数。以EOF结束。

Output

输出这n个数中最大的值,每个输出占一行。

Examples

Input

3
6 8 5
8
5 6 7 3 100000000 6 9 2

Output

8
100000000

Solution C

#include <stdio.h>
int main()
{
	int n;
	long long max, t;
	while (scanf("%d", &n) != EOF){
		scanf("%lld", &t);
		max = t;
		for (int i = 1; i < n; i++){
			scanf("%lld", &t);
			if (t > max)
				max = t;
		}
		printf("%lld\n", max);
	}
}

Solution C++

#include <stdio.h>
int main()
{
	long long n, t, max;
	while (scanf("%lld", &n) != EOF){
		scanf("%lld", &t);
		max = t;
		for (int i = 1; i < n; i++){
			scanf("%lld", &t);
			if (t > max)
				max = t;
		}
		printf("%lld\n", max);
	}
}
Time Limit 1 second
Memory Limit 128 MB
Discuss Stats
上一题 下一题