社区讨论

求解,为什么不能重载<

P1012[NOIP 1998 提高组] 拼数参与者 6已保存回复 11

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
11 条
当前快照
1 份
快照标识符
@lzru2voe
此快照首次捕获于
2024/08/13 10:58
2 年前
此快照最后确认于
2024/08/13 13:27
2 年前
查看原帖
CPP
#include<bits/stdc++.h>
using namespace std;
string a[23];
const bool operator<(const string &x,const string &y) { return (y+x>x+y); }
//bool cmmp(const string &x, const string &y) { return (x + y < y + x); }
int main(){
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
      cin >> a[i];
    sort(a+1,a+n+1);
    for (int i = n; i >=1 ;i -- )
      cout << a[i];
    return 0;
}

为什么用注释掉的那一行就没问题 用重载就不对呢,求大佬解答

回复

11 条回复,欢迎继续交流。

正在加载回复...