C++语法求助
  • 板块题目总版
  • 楼主QAQqqqqqq
  • 当前回复1
  • 已保存回复1
  • 发布时间2023/8/15 12:29
  • 上次更新2023/11/3 03:40:36
查看原帖
C++语法求助
507675
QAQqqqqqq楼主2023/8/15 12:29

在sortsort的时候,一般都是用<或者>的,但是之前写代码的时候写成了≤\le,然后发现RE了,而≥\ge好像又不会RE,问一下为什么

下面是一个简单的代码,也会导致RE,而换成≥\ge后就不会RE了

#include <bits/stdc++.h>
using namespace std;
int num[100010];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    mt19937 rnd((unsigned)time(nullptr));
    for (int i = 1; i <= 100000; i++) num[i] = rnd() % 100;
    sort(num + 1, num + 100001, [&](const int &a, const int &b) {return a <= b;});
    return 0;
}

2023/8/15 12:29
加载中...