题解 | #找最小数#

找最小数

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

#include <iostream>
#include <algorithm>

using namespace std;

struct couple{
	int x;
	int y;
}c[100];

int n;

bool cmp(couple a,couple b){
	if(a.x == b.x){
		return a.y < b.y;
	}else {
		return a.x < b.x;
	}
}
int main(){
	while(cin >> n){
		for(int i = 0;i < n;i ++)cin >> c[i].x >> c[i].y;
		sort(c,c + n,cmp);
		cout << c[0].x << " " << c[0].y;
	}	
	return 0;
}

全部评论

相关推荐

gelmanspar...:奖学金删掉,自我评价删掉,简历压缩一下,写一页
如果再来一次,你还会学机...
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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