题解 | #找最小数#

找最小数

https://www.nowcoder.com/practice/ba91786c4759403992896d859e87a6cd

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

struct Entity {
    int x,y;
    Entity() { cin >> x >> y; }
    bool operator<(const Entity &other) const {
        return this->x == other.x ? this->y < other.y : this->x < other.x;
    }
    void display() const {
        cout << this->x << " " << this->y << endl;
    }
};

int main() {
    int n;
    cin >> n;
    vector<Entity> list(n);
    min_element(list.begin(), list.end())->display();
}

全部评论

相关推荐

不愿透露姓名的神秘牛友
11-16 01:46
点赞 评论 收藏
分享
牛至超人:把哈工大,再加大加粗,看见闪闪发光的哈工大字样,面试官直接流口水
投递字节跳动等公司10个岗位
点赞 评论 收藏
分享
孙艹肘:校招不给三方直接让实习我都去了,,主打一个在学校呆着也是闲着,不如出来实习一下
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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