题解 | #找最小数#

找最小数

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

#include<cstdio>
#include<algorithm>
using namespace std;
struct num{
	int x;
	int y;
};
bool ans(num rhs, num lhs){
	if (rhs.x > lhs.x){
		return true;
	}
	else if (rhs.x == lhs.x&&rhs.y > lhs.y){
		return true;
	}
	else{
		return false;
	}
}
int main(){
	int n;
	num  op[1000];
	while (scanf("%d", &n) != EOF){
		for (int i = 0; i < n; i++){
			scanf("%d %d", &op[i].x, &op[i].y);
		}
		sort(op, op + n,ans);
		printf("%d %d\n", op[n - 1].x, op[n - 1].y);
	}
}

全部评论

相关推荐

ResourceUtilization:差不多但是估计不够准确,一面没考虑到增长人口,另一方面也没考虑到能上大学的人数比例,不过我猜肯定只多不少
点赞 评论 收藏
分享
ResourceUtilization:四六级不愧是大学最有用的证之一
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务