基础训练 数列特征

数列特征

#include<iostream>
#include<math.h>
using namespace std;
int main(){
	int n, sum=0, maxn=-999999, minn=999999, t;
	cin>>n;
	for(int i=0; i<n; i++){
		cin>>t;
		maxn=max(maxn, t);
		minn=min(minn, t);
		sum+=t;
	}
	cout<<maxn<<endl<<minn<<endl<<sum<<endl;
	return 0;
}
posted @ 2019-01-24 21:10  A-Little-Nut  阅读(127)  评论(0编辑  收藏  举报