题解 | #找最小数#

找最小数

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

#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
const int MAXN=1001;
struct a{
    int x;
    int y;
};
a arr_xy[MAXN];
bool Compare(a m,a n){
    return m.x<n.x;
}
int main() {
    int n;
    while(scanf("%d",&n)!=EOF){
        for(int i=0;i<n;++i){
            scanf("%d",&arr_xy[i].x);
            scanf("%d",&arr_xy[i].y);
        }
        sort(arr_xy,arr_xy+n,Compare);
        int temp=arr_xy[0].y;
        for(int i=1;arr_xy[i].x==arr_xy[0].x;++i){
            temp=arr_xy[i].y<temp?arr_xy[i].y:temp;
        }
        cout<<arr_xy[0].x<<" "<<temp<<endl;
    }
	return 0;
}

全部评论

相关推荐

感觉今年拿到大厂实习offer的人很多,光是身边同学室友都是好几个offer。由此可见,秋招得有多卷
小浪_Coding:必须卷的起飞, 应该比25更卷一点, 25已经是哀声一片了, 26会更难一点, 现在还有`很多25未找到的
点赞 评论 收藏
分享
Rena1ssance_:对的,要是面评没太烂,勤更新简历等捞就行了,腾讯可以无限复活
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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