求vector数组nums的最小值和最大值
//仅需要知道数组的开头和结尾
auto res = minmax_element(nums.begin(), nums.end());
cout << "最小值:" << *(res.first);
cout << "最大值:" << *(res.second);
求vector数组nums的最小值和最大值
//仅需要知道数组的开头和结尾
auto res = minmax_element(nums.begin(), nums.end());
cout << "最小值:" << *(res.first);
cout << "最大值:" << *(res.second);