vector和数组都能使用,vector需要改为x.begin.....
#include<bits/stdc++.h>
using namespace std;
int a[10] = {1 ,4 , 7 , 2};
int main()
{
int x = *min_element(a, a + 4); // 最大值
cout << x << '\n';
x = *min_element(a, a + 4); // 最小值
cout << x << '\n';
x = accumulate(a, a + 10, 0LL); // 数组和,0LL是固定写法
cout << x << '\n';
return 0;
}