题解 | 找最小数

找最小数

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

//KY197 找最小数
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
int n;
struct E{
    int x, y;
    bool operator <(const E &s)const{
        if(x==s.x) return y<s.y;
        return x<s.x;
    }
}e[1005];
int main()
{
    while(cin>>n)
    {
        for(int i=1;i<=n;i++) cin>>e[i].x>>e[i].y;
        sort(e+1,e+n+1);
        cout<<e[1].x<<" "<<e[1].y<<'\n';
    }
    return 0;
}

全部评论

相关推荐

明明就不饿:看不懂你到底会啥,什么岗位
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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