题解 | #获取数组最值#

获取数组最值

https://www.nowcoder.com/practice/53d110f6cdd14f21af285698f975b59c

#include <algorithm>
#include <iostream>
#include <iterator>
#include <vector>
using namespace std;

int main() {

    vector<int> arr(6, 0);
    
    for (int i = 0;i < arr.size();i++) {
        int n;
        cin >> n;
        arr.at(i) = n;
    }

    auto res = minmax_element(arr.begin(), arr.end());
    cout << *res.first << " " << *res.second;
    // cout << *res.first  << " " << *res.second << endl;
    

    // write your code here......
    

    return 0;
}

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务