基础练习 数列特征

2019-03-16  本文已影响0人  HeoLis

http://lx.lanqiao.cn/problem.page?gpid=T8

#include<iostream>
using namespace std;


int main(){
    int n, num;
    long sum = 0;
    int min = 999999999;
    int max = -99999999;
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        cin >> num;
        if(num < min)
            min = num;
        if(num > max)
            max = num;
        sum += num;
    }
    cout << max << endl;
    cout << min << endl;
    cout << sum << endl;
    return 0;
}
上一篇下一篇

猜你喜欢

热点阅读