题解 | #找最小数#
找最小数
https://www.nowcoder.com/practice/ba91786c4759403992896d859e87a6cd
//土尔逊Torson 编写于2023/4/14
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <algorithm>
#include <stdlib.h>
using namespace std;
const int nMax = 1001;
struct NLab {
int x;
int y;
};
bool comp0331(NLab left, NLab right) {
if (left.x < right.x) {
return true;
}
else if (left.x == right.x && left.y < right.y) {
return true;
}
else {
return false;
}
}
int main() {
int n;
NLab arr[nMax];
while (scanf("%d", &n) != EOF) {
for (int i = 0; i < n; ++i) {
scanf("%d %d", &arr[i].x, &arr[i].y);
}
sort(arr, arr + n, comp0331);
printf("%d %d", arr[0].x, arr[0].y);
}
system("pause");
return EXIT_SUCCESS;
}
// 64 位输出请用 printf("%lld")
