题解 | #找最小数#

找最小数

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

#include<iostream>
#include<queue>
using namespace std;
struct number{
    int x;
    int y;
    number(int a,int b) : x(a),y(b){};
};
struct cmp{
    bool operator() (number a,number b){
        if(a.x == b.x)    return a.y > b.y;
        return a.x > b.x;
    }
};
int main(){
    int n;
    cin >> n;
    priority_queue<number,vector<number>,cmp> que;
    while(n--){
        int m,q;
        cin >>m >>q;
        que.push(number(m,q));
    }
    cout << que.top().x << ' ' << que.top().y << endl;
    return 0;
}
全部评论

相关推荐

不愿透露姓名的神秘牛友
今天 11:30
点赞 评论 收藏
分享
程序员小白条:这比例牛逼,750:1
点赞 评论 收藏
分享
07-07 12:47
门头沟学院 Java
码农索隆:竟然还真有卡体检报告的
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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