做tc时被这个问题纠结住了,后来问了大牛,可以这样写。

 1 class EvenRoute {
2 public:
3 struct node {
4 int x;
5 int y;
6 node(int a = 0, int b = 0) : x(a), y(b) {}
7 };
8
9 static bool cmp(const node& c, const node& d) {   //加static
10 if(c.x == d.x) return c.y < d.y;
11 return c.x < d.x;
12 }
13
14 string isItPossible(vector <int> x, vector <int> y, int w) {
15 struct node a[1000];
16 int n = 1000;
17 //....
18 sort(a, a + n, cmp);
19 return "CAN";
20 }
21 };



相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-01
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-19
  • 2022-12-23
  • 2021-06-19
  • 2022-12-23
  • 2021-11-19
相关资源
相似解决方案