- 【入门】坐标排序
xxx
- 2024-4-8 20:47:55 @
xxx
1 条评论
-
ptxy1021 LV 4 @ 2024-4-8 20:48:28
#include<bits/stdc++.h> using namespace std; struct sb { int x;** int y;** }; sb a[10100]; bool cmp (sb a , sb b) { if (a.x < b.x) { ** return true;** ** } ** if (a.x == b.x){ ** if (a.y < b.y) { ** return true; } return false; ** } ** return false; } int main(){ ** int n; ** cin >> n; ** for (int i = 1 ; i <= n ; i++) { ** cin >> a[i].x >> a[i].y; ** } ** sort(a + 1 , a + 1 + n , cmp); ** for (int i = 1 ; i <= n ; i++){ ** cout << a[i].x << " " << a[i].y << endl; ** } ** return 0; }
- 1
信息
- ID
- 487
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 5
- 标签
- 递交数
- 20
- 已通过
- 14
- 上传者