最值
#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; }
永远渴望,大智若愚(stay hungry, stay foolish)