最值

#include<algorithm>
#include<iostream>
#include<stdio.h>
#include<list>
using namespace std;

int main()
{
	int n, m, sum;
	sum = 0;
	scanf("%d", &n);
	list<int> l;
	
	for(int i = 0; i < n; i++)
	{
		scanf("%d", &m);
		sum = sum + m;
		l.push_back(m);
	}
	
	printf("%d\n", *max_element(l.begin(), l.end()));
	printf("%d\n", *min_element(l.begin(), l.end()));
	printf("%d\n", sum);
	
	return 0;
}

  

posted @ 2018-02-02 17:50  Veritas_des_Liberty  阅读(263)  评论(0编辑  收藏  举报