Files
python/TangDou/Mkx/20241103/2.cpp

29 lines
847 B
C++
Raw Normal View History

2025-08-30 18:35:01 +08:00
#include <bits/stdc++.h>
using namespace std;
const int N = 110;
struct node {
int x, y;
int no;
int z;
} a[N];
int n;
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
scanf("%d%d", &a[i].x, &a[i].y); // 坐标
a[i].no = i; // 输入序号
}
int mx = 0, id = 0;
// 利用双重循环,找出i点左下方的点的个数,即它的战斗力
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++)
if (a[i].x > a[j].x && a[i].y > a[j].y) a[i].z++;
// 记录战斗力最高的
if (mx <= a[i].z) mx = a[i].z, id = i;
}
// 输出每个点的战斗力,并且,输出战斗力最高的点的序号
for (int i = 1; i <= n; i++) cout << a[i].z << endl;
cout << id << endl;
return 0;
}: